From 40231016f95fd89ebbce09b5fd635de046ad6fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=C3=A9chelotte?= Date: Mon, 7 Oct 2013 23:49:24 +0200 Subject: [PATCH] Prevent crash when toggling auto-attract on a drawer with clip disabled toggleAutoAttractCallback needs to check whether there are clips before iterating through them (or it crashes WM!). The extra test is needed because now drawers can auto-attract as well. Before drawers, only clips could auto-attract, so testing wPreferences.flags.noclip was pointless. --- src/dock.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/dock.c b/src/dock.c index 5ca6c106..e14e437f 100644 --- a/src/dock.c +++ b/src/dock.c @@ -619,10 +619,13 @@ static void toggleAutoAttractCallback(WMenu *menu, WMenuEntry *entry) if (dock->type == WM_DRAWER) { /* The newly auto-attracting dock is a drawer: disable any clip and * previously attracting drawer */ - int i; - for (i = 0; i < w_global.workspace.count; i++) - w_global.workspace.array[i]->clip->attract_icons = False; - /* dock menu will be updated later, when opened */ + + if (!wPreferences.flags.noclip) { + int i; + for (i = 0; i < w_global.workspace.count; i++) + w_global.workspace.array[i]->clip->attract_icons = False; + /* dock menu will be updated later, when opened */ + } if (scr->attracting_drawer != NULL) scr->attracting_drawer->attract_icons = False;