Delay performWindowOperation to next event cycle in UserActionsMenu

In case that the window operation results in destroying the window
decoration we need to have the menu closed before the deco gets
destroyed. Otherwise Qt crashes.
icc-effect-5.14.5
Martin Gräßlin 2013-08-19 12:15:42 +02:00
parent be9b9681db
commit c2e0c13b7b
3 changed files with 9 additions and 3 deletions

View File

@ -1219,5 +1219,6 @@ inline int KDecoration::height() const
/** @} */
Q_DECLARE_OPERATORS_FOR_FLAGS(KDecoration::QuickTileMode)
Q_DECLARE_METATYPE(KDecorationDefines::WindowOperation)
#endif

View File

@ -770,7 +770,13 @@ void UserActionsMenu::slotWindowOperation(QAction *action)
};
if (!type.isEmpty())
helperDialog(type, c);
Workspace::self()->performWindowOperation(c.data(), op);
// need to delay performing the window operation as we need to have the
// user actions menu closed before we destroy the decoration. Otherwise Qt crashes
qRegisterMetaType<KDecorationDefines::WindowOperation>();
QMetaObject::invokeMethod(workspace(), "performWindowOperation",
Qt::QueuedConnection,
Q_ARG(KWin::Client*, c.data()),
Q_ARG(KDecorationDefines::WindowOperation, op));
}
void UserActionsMenu::slotSendToDesktop(QAction *action)

View File

@ -233,8 +233,6 @@ public:
void updateOnAllDesktopsOfTransients(Client*);
void checkTransients(xcb_window_t w);
void performWindowOperation(Client* c, WindowOperation op);
void storeSession(KConfig* config, SMSavePhase phase);
void storeClient(KConfigGroup &cg, int num, Client *c);
void storeSubSession(const QString &name, QSet<QByteArray> sessionIds);
@ -302,6 +300,7 @@ public:
bool compositing() const;
public Q_SLOTS:
void performWindowOperation(KWin::Client* c, KDecorationDefines::WindowOperation op);
// Keybindings
//void slotSwitchToWindow( int );
void slotWindowToDesktop();