Merge lp:~gerboland/miral/fix-crash-on-window-close into lp:miral

Proposed by Gerry Boland
Status: Merged
Approved by: Alan Griffiths
Approved revision: 308
Merged at revision: 310
Proposed branch: lp:~gerboland/miral/fix-crash-on-window-close
Merge into: lp:miral
Diff against target: 15 lines (+4/-1)
1 file modified
miral-qt/src/modules/Unity/Application/windowmodel.cpp (+4/-1)
To merge this branch: bzr merge lp:~gerboland/miral/fix-crash-on-window-close
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Review via email: mp+304631@code.launchpad.net

Commit message

[miral-qt] Fix crash where we try to use a focused window after it has been removed

Description of the change

To test, run gnome-calculator, and change modes.

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Works for me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'miral-qt/src/modules/Unity/Application/windowmodel.cpp'
2--- miral-qt/src/modules/Unity/Application/windowmodel.cpp 2016-08-25 10:20:56 +0000
3+++ miral-qt/src/modules/Unity/Application/windowmodel.cpp 2016-09-01 12:10:18 +0000
4@@ -81,7 +81,10 @@
5 void WindowModel::onWindowRemoved(const int index)
6 {
7 beginRemoveRows(QModelIndex(), index, index);
8- m_windowModel.remove(index);
9+ auto window = m_windowModel.takeAt(index);
10+ if (window == m_focusedWindow) {
11+ m_focusedWindow = nullptr;
12+ }
13 endRemoveRows();
14 Q_EMIT countChanged();
15 }

Subscribers

People subscribed via source and target branches