On Tue, 03 Jan 2012 09:01:06 -0800 Matthew Brush mbrush@codebrainz.ca wrote:
On 01/03/2012 08:45 AM, Matthew Brush wrote:
On 12/31/2011 02:57 AM, Frank Lanitz wrote:
Hi folks,
Since about GtkBuilder come in into Geany core we are experiencing some issue with GeanyLaTeX in terms of in some cases the toolbar is not able tobe loaded and Geany is ending up inside a segfault. Most likely its repreducable by activating the toolbar and restarting Geany having a tex-file loaded. The issue seems to be located in near of line https://github.com/geany/geany-plugins/blob/master/geanylatex/src/geanylatex...
unfortunately I don't have any bloody idea, what might is going wrong. Anyone else could jump in here?
Attached is a patch to fix the issue. It's the same bug in Geany where this code was probably copied from, so I'll fix Geany and leave it to you to apply this patch to the plugin. If either Geany or GeanyLatex is fixed the plugin will be fixed, but for correctness I guess they should both be fixed.
IIUC what's happening is Geany's variable (toolbar.c:toolbar_markup) is declared const but not static so it's global to the entire program. When the plugin is loaded (at runtime with dlopen) with the same variable name also declared const, the one previously defined in Geany is used instead. If Geany's is declared static, GeanyLatex uses it's own variable because it can't see Geany's, if it's declared static in GeanyLatex, the local scope wins I guess.
So what was happening was GeanyLatex was loading Geany's toolbar XML string constant instead of it's own (which obviously is a problem).
I'd love to know why this changed all of the sudden though, why it's different from before.
I fixed in Geany in this commit:
https://github.com/geany/geany/commit/8f489fc9fbab8a8c197f40536fac8ebd74c430...
So if you pull from Geany's repo and rebuild, even before applying the patch, the toolbar problem should be fixed, but probably best to apply the same changes as in that commit the plugin as well.
Thanks for the finding. I've applied it locally and will give it a test.
Cheers, Frank