[Geany-devel] [Patch] Avoid crash when opening project properties dialog

Lex Trotman elextr at xxxxx
Tue Mar 9 08:48:39 UTC 2010


On 9 March 2010 18:43, Wolfgang Ocker <weo at reccoware.de> wrote:

> I observed a crash in build_commands_table() when trying to open the
> project properties window:
>
>
> #0  build_commands_table (doc=<value optimized out>,
>    dst=<value optimized out>, table_data=<value optimized out>, ft=0x0)
>    at build.c:1862
> #1  0x000000000047bc0d in create_properties_dialog () at project.c:481
> #2  project_properties () at project.c:539
> #3  0x00000039da80ba8e in g_closure_invoke ()
> from /lib64/libgobject-2.0.so.0
> #4  0x00000039da820ec3 in ?? () from /lib64/libgobject-2.0.so.0
> #5  0x00000039da822259 in g_signal_emit_valist ()
>   from /lib64/libgobject-2.0.so.0
> #6  0x00000039da8227a3 in g_signal_emit ()
> from /lib64/libgobject-2.0.so.0
> #7  0x0000003653c7d3be in gtk_widget_activate ()
>   from /usr/lib64/libgtk-x11-2.0.so.0
> ...
>
> ft is NULL there, which looks like a valid value, since ft is tested for
> NULL explicitly in line 1878. So I propose the following patch.
>
> Best regards,
> Wolfgang
>
> Index: src/build.c
> ===================================================================
> --- src/build.c (revision 4745)
> +++ src/build.c (working copy)
> @@ -1859,7 +1859,7 @@
>        sep = gtk_hseparator_new();
>        gtk_table_attach(table, sep, 0, DC_N_COL, 1, 2, GTK_FILL, GTK_FILL |
> GTK_EXPAND,
>                entry_x_padding, sep_padding);
> -       if (ft->id != GEANY_FILETYPES_NONE)
> +       if (ft != NULL && ft->id != GEANY_FILETYPES_NONE)
>                txt = g_strdup_printf(_("%s Commands"), ft->title);
>        else
>                txt = g_strdup_printf(_("%s Commands"), _("No Filetype"));
>
>
>
Thanks, one more change is needed, ft isn't initialised to NULL so on my
machine it doesn't crash :-S, needs the declaration of ft to be initialised
to NULL so your test will reliably fail if ft isn't set.

I will have to get a clean copy of trunk to apply the patch to (mine is full
of changes :-) but will do so as soon as possible if no one beats me to it.

Cheers
Lex


> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20100309/f9cd771b/attachment.html>


More information about the Devel mailing list