Skip to content

"Send to desktop" and changing "Layer" of a closed client causes a crash #30

@ymmcake

Description

@ymmcake

If you open "Send to desktop" submenu of the client menu, and select the new desktop after the client has been closed, (for example it was a video player that finished playing) a crash happens. The same is true for "Layer" submenu. The fix is easy:

diff --git a/openbox/client_menu.c b/openbox/client_menu.c
index 4a3b286f..f1bd6005 100644
--- a/openbox/client_menu.c
+++ b/openbox/client_menu.c
@@ -216,7 +216,8 @@ static void layer_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
 {
     gulong ignore_start;
 
-    g_assert(c);
+    if (!c)
+        return;
 
     if (!config_focus_under_mouse)
         ignore_start = event_start_ignore_all_enters();
@@ -288,7 +289,8 @@ static gboolean send_to_menu_update(ObMenuFrame *frame, gpointer data)
 static void send_to_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
                                  ObClient *c, guint state, gpointer data)
 {
-    g_assert(c);
+    if (!c)
+        return;
 
     client_set_desktop(c, e->id, FALSE, FALSE);
     if (f && c->desktop != screen_desktop && c->desktop != DESKTOP_ALL)

Note that client_menu_execute already does this. (see 0cd6f4e)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions