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
=== modified file 'miral-qt/src/modules/Unity/Application/windowmodel.cpp'
--- miral-qt/src/modules/Unity/Application/windowmodel.cpp 2016-08-25 10:20:56 +0000
+++ miral-qt/src/modules/Unity/Application/windowmodel.cpp 2016-09-01 12:10:18 +0000
@@ -81,7 +81,10 @@
81void WindowModel::onWindowRemoved(const int index)81void WindowModel::onWindowRemoved(const int index)
82{82{
83 beginRemoveRows(QModelIndex(), index, index);83 beginRemoveRows(QModelIndex(), index, index);
84 m_windowModel.remove(index);84 auto window = m_windowModel.takeAt(index);
85 if (window == m_focusedWindow) {
86 m_focusedWindow = nullptr;
87 }
85 endRemoveRows();88 endRemoveRows();
86 Q_EMIT countChanged();89 Q_EMIT countChanged();
87}90}

Subscribers

People subscribed via source and target branches