From 7cb7f17a11c234ab70cf533a828646b77daeb005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 31 Jan 2009 13:23:58 +0000 Subject: [PATCH] Abort effect if the current tab box window is deleted and the tabbox is empty afterwards. This hopefully resolves the crashes when a window is closed during active effect. At least I was not able to reproduce a crash anymore. If further testing shows that it resolves the problem the patch will be backported to branch and to other window switching effects showing the same problem. CCBUG: 182358 svn path=/trunk/KDE/kdebase/workspace/; revision=919075 --- effects/coverswitch.cpp | 19 +++++++++++++++++++ effects/coverswitch.h | 1 + 2 files changed, 20 insertions(+) diff --git a/effects/coverswitch.cpp b/effects/coverswitch.cpp index b7369a1990..de232cc4a5 100644 --- a/effects/coverswitch.cpp +++ b/effects/coverswitch.cpp @@ -101,6 +101,8 @@ void CoverSwitchEffect::prePaintScreen( ScreenPrePaintData& data, int time ) (dynamicThumbnails && effects->currentTabBoxWindowList().size() >= thumbnailWindows)) ) calculateItemSizes(); } + if( effects->currentTabBoxWindow() == NULL ) + abort(); } effects->prePaintScreen(data, time); } @@ -1476,5 +1478,22 @@ void CoverSwitchEffect::windowInputMouseEvent( Window w, QEvent* e ) } } +void CoverSwitchEffect::abort() + { + effects->unrefTabBox(); + effects->setActiveFullScreenEffect( 0 ); + effects->destroyInputWindow( input ); + mActivated = false; + stop = false; + stopRequested = false; + effects->addRepaintFull(); + if( thumbnails && (!dynamicThumbnails || + (dynamicThumbnails && effects->currentTabBoxWindowList().size() >= thumbnailWindows)) ) + { + qDeleteAll( windows ); + windows.clear(); + } + } + } // namespace diff --git a/effects/coverswitch.h b/effects/coverswitch.h index 1ee04e6dfb..3014ed386f 100644 --- a/effects/coverswitch.h +++ b/effects/coverswitch.h @@ -58,6 +58,7 @@ class CoverSwitchEffect void paintWindowCover( EffectWindow* w, bool reflectedWindow, WindowPaintData& data ); void paintFrontWindow( EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow ); void paintWindows( QList< EffectWindow* >* windows, bool left, bool reflectedWindows, EffectWindow* additionalWindow = NULL ); + void abort(); // thumbnail bar class ItemInfo; void calculateFrameSize();