[Geany-devel] g_thread_init()?

Lex Trotman elextr at xxxxx
Sun Mar 27 05:38:46 UTC 2011

On 27 March 2011 15:59, Matthew Brush <mbrush at codebrainz.ca> wrote:
> Hi,
> Should Geany be calling g_thread_init() for the plugins?  There is now 4
> plugins at least affected[1][2][3][4].

Its safe to call g_thread_init multiple times, but ...

Well, g_thread_init should not be called in plugin_init since that can
be called from a signal callback and thats a no-no according to the

There are also a list of other issues about when it can be called,
right at the beginning of the program is a really good place.

And the link options need to be different for programs using
g_thread_init, and having the plugins linked differently to the main
app might have other issues.

So in general, if any plugin uses glib from threads then yes Geany
should use g_thread_init once for all the program, and Geany and
plugins should link with "pkg-config --libs gthread-2.0"

And since you have identified four that do use threads ...


> [1]
> https://github.com/codebrainz/geany-plugins/commit/99afbc6d0286081c7586e75c829c18b69e26731f#L1R420
> [2]
> https://github.com/codebrainz/geany-plugins/blob/5b4b64b3d193f5fb5293a99ddc8503343586c9fe/geany-plugins/devhelp/src/plugin.c
> [3] http://pastebin.com/9MV5i0Gw
> [4] James Geboski is working on a new plugin and he got caught by this also.
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

More information about the Devel mailing list