Segfault pressing Menu key (was Small bug)

Henrik Brautaset Aronsen subsurface at henrik.synth.no
Tue Jan 29 03:12:42 PST 2013


Sergey Starosek wrote:
> On Mon Jan 28 23:42 Pierre-Yves Chibon wrote:
>
>> On my keyboard I have a key on the right side of the space bar, between
>> the alt+gr key and the right ctrl which most of the time emulates the
>> right mouse click.
>> If I press this button on subsurface, I end up with:
>> Segmentation fault (core dumped)
>> This whatever the selection and nicely always reproducible.
>
>
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> [New Thread 0x7fffec508700 (LWP 4243)]
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000000000425690 in popup_divelist_menu (tree_view=0x7c81b0,
> model=0x6f8800, button=0, event=0x0) at divelist.c:2356
> 2356		if (!gtk_tree_view_get_path_at_pos(tree_view, event->x,
> event->y,&path, NULL, NULL, NULL))
> (gdb) bt

This patch should fix it:

diff --git a/divelist.c b/divelist.c
index b31c9ac..290baba 100644
--- a/divelist.c
+++ b/divelist.c
@@ -2353,7 +2353,7 @@ static void popup_divelist_menu(GtkTreeView 
*tree_view, GtkTreeModel *model, int
         int idx, previdx, nextidx;
         struct dive *dive;

-       if (!gtk_tree_view_get_path_at_pos(tree_view, event->x, 
event->y, &path, NULL, NULL, NULL))
+       if (!event || !gtk_tree_view_get_path_at_pos(tree_view, 
event->x, event->y, &path, NULL, NULL, NULL))
                 return;
         gtk_tree_model_get_iter(MODEL(dive_list), &iter, path);
         gtk_tree_model_get(MODEL(dive_list), &iter, DIVE_INDEX, &idx, -1);

Henrik




More information about the subsurface mailing list