[PATCH] Fix segfault pressing Menu key

subsurface at henrik.synth.no subsurface at henrik.synth.no
Tue Jan 29 10:06:08 PST 2013


From: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>

Pierre 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."

This patch doesn't make the key work, but it fixes the segfault.

Reported-by: Pierre-Yves Chibon <pingou at pingoured.fr>
Debugged-and-acked-by: Sergey Starosek <sergey.starosek at gmail.com>
Signed-off-by: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>
---
 divelist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
-- 
1.8.1.1



More information about the subsurface mailing list