Use non-symlinked VTE libraries on macOS (#1625)
commit3fb94c235c91a980a7fd7aa159f373b457833148
authorJiří Techet <techet@gmail.com>
Sat, 7 Oct 2017 00:48:47 +0000 (7 02:48 +0200)
committerelextr <elextr@gmail.com>
Sat, 7 Oct 2017 00:48:47 +0000 (7 10:48 +1000)
treee4006783c6f30f9b2b073ca211f19f443686f5b7
parentb4415b16dacff0d79ff15747dfdbf87b2a282848
Use non-symlinked VTE libraries on macOS (#1625)

* Try non-symlinked VTE libraries on macOS before the symlinked ones

Plugins using VTE such as multiterm or debugger are linked against the
non-symlinked version of the library like libvte.9.dylib and not
libvte.dylib. When a bundle is created, all symlinks are replaced by
a copy of the symlinked file. This means there are both libvte.dylib
and libvte.9.dylib in the bundle both containing the same code. When
Geany loads libvte.dylib and plugins load libvte.9.dylib the same code
gets loaded twice and when the same type gets registered by GTK, it fails
and the whole application freezes.

This problem doesn't exist on linux or when running from the command line
on macOS because the operating system detects it's the same library
because of the symlink and it's loaded only once.

Loading the same library as the one used by plugins fixes the issue with
macOS bundle. The original symlinked name is still used as a fallback.

The patch also adds #ifdef __APPLE__ around the Apple-specific library
names which also prevents unnecessary retries on other platforms. Loading
*.so libraries is still kept as a fallback on Apple as these are legal too
and could in theory be used on OS X as well.

* Try loading newer VTE versions before older ones on GTK 2
src/vte.c