]> Dogcows Code - chaz/openbox/blobdiff - openbox/menuframe.c
only execute enabled items
[chaz/openbox] / openbox / menuframe.c
index 053034b3869a783ddae60bfb6821447368e4e4f1..56dbc647c48b1702f6f1f8eb1a331780fa56b0c1 100644 (file)
@@ -571,20 +571,29 @@ void menu_entry_frame_show_submenu(ObMenuEntryFrame *self)
 
 void menu_entry_frame_execute(ObMenuEntryFrame *self, gboolean hide)
 {
-    if (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL) {
+    if (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL &&
+        self->entry->data.normal.enabled)
+    {
+        /* grab all this shizzle, cuz when the menu gets hidden, 'self'
+           gets freed */
+        ObMenuEntry *entry = self->entry;
+        ObMenuExecuteFunc func = self->frame->menu->execute_func;
+        gpointer data = self->frame->menu->data;
+        GSList *acts = self->entry->data.normal.actions;
+        ObClient *client = self->frame->client;
+
         /* release grabs before executing the shit */
         menu_frame_hide_all();
 
-        if (self->frame->menu->execute_func)
-            self->frame->menu->execute_func(self, self->frame->menu->data);
+        if (func)
+            func(entry, data);
         else {
             GSList *it;
 
-            for (it = self->entry->data.normal.actions; it;
-                 it = g_slist_next(it))
+            for (it = acts; it; it = g_slist_next(it))
             {
                 ObAction *act = it->data;
-                act->data.any.c = self->frame->client;
+                act->data.any.c = client;
                 act->func(&act->data);
             }
         }
This page took 0.023114 seconds and 4 git commands to generate.