[Geany-devel] Issue with geanyLaTeX after GtkBuilder: Help needed to debug

Matthew Brush mbrush at xxxxx
Tue Jan 3 16:45:38 UTC 2012


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.c#L168
> 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.

Cheers,
Matthew Brush


-------------- next part --------------
A non-text attachment was scrubbed...
Name: geanylatex-staticvar.patch
Type: text/x-diff
Size: 431 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20120103/c05e8577/attachment.patch>


More information about the Devel mailing list