]> git.street.me.uk Git - andy/viking.git/commitdiff
Prevent obscure crash on key press when layer is not selected but create track tool...
authorRob Norris <rw_norris@hotmail.com>
Tue, 9 Oct 2012 18:47:38 +0000 (19:47 +0100)
committerRob Norris <rw_norris@hotmail.com>
Tue, 9 Oct 2012 22:08:51 +0000 (23:08 +0100)
Ensure secondary key press processing only occurs for window level tools
Fixup commit SHA1: a71145218059e3e8153b9e58493d3a0d57743324

src/vikwindow.c

index ef4e2bc67938bd00da1d1291d1a8156ef8ac02f8..4818ee171b03bd1eae90949892255afc5fcaabd6 100644 (file)
@@ -489,9 +489,12 @@ static gboolean key_press_event( VikWindow *vw, GdkEventKey *event, gpointer dat
       return vw->vt->tools[vw->vt->active_tool].ti.key_press(vl, event, vw->vt->tools[vw->vt->active_tool].state);
   }
 
       return vw->vt->tools[vw->vt->active_tool].ti.key_press(vl, event, vw->vt->tools[vw->vt->active_tool].state);
   }
 
-  // No layer - but enable window tool keypress processing - these should be able to handle a NULL layer
-  if ( vw->vt->tools[vw->vt->active_tool].ti.key_press ) {
-    return vw->vt->tools[vw->vt->active_tool].ti.key_press ( vl, event, vw->vt->tools[vw->vt->active_tool].state );
+  // Ensure called only on window tools (i.e. not on any of the Layer tools since the layer is NULL)
+  if ( vw->current_tool < TOOL_LAYER ) {
+    // No layer - but enable window tool keypress processing - these should be able to handle a NULL layer
+    if ( vw->vt->tools[vw->vt->active_tool].ti.key_press ) {
+      return vw->vt->tools[vw->vt->active_tool].ti.key_press ( vl, event, vw->vt->tools[vw->vt->active_tool].state );
+    }
   }
 
   /* Restore Main Menu via Escape key if the user has hidden it */
   }
 
   /* Restore Main Menu via Escape key if the user has hidden it */