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


diff --git a/geanylatex/src/geanylatex.c b/geanylatex/src/geanylatex.c
index e1bab6e..a27c98b 100644
--- a/geanylatex/src/geanylatex.c
+++ b/geanylatex/src/geanylatex.c
@@ -124,7 +124,7 @@ const guint ui_entries_n = G_N_ELEMENTS(format_icons);
 
 
 /* fallback UI definition */
-const gchar *toolbar_markup =
+static const gchar *toolbar_markup =
 "<ui>"
 	"<toolbar name='glatex_format_toolbar'>"
 		"<toolitem action='Wizard'/>"
_______________________________________________
Geany-devel mailing list
Geany-devel@uvena.de
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

Reply via email to