Merge lp:~3v1n0/unity/scale-window-cast-protection into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4223
Proposed branch: lp:~3v1n0/unity/scale-window-cast-protection
Merge into: lp:unity
Diff against target: 56 lines (+17/-6)
1 file modified
plugins/unityshell/src/unityshell.cpp (+17/-6)
To merge this branch: bzr merge lp:~3v1n0/unity/scale-window-cast-protection
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+318516@code.launchpad.net

Commit message

UnityWindow: safely check validity of UnityWindow from scaled one

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2017-01-09 15:09:26 +0000
+++ plugins/unityshell/src/unityshell.cpp 2017-02-28 17:20:41 +0000
@@ -587,12 +587,14 @@
587587
588 for (auto const& swin : sScreen->getWindows())588 for (auto const& swin : sScreen->getWindows())
589 {589 {
590 if (filtered_windows.find(swin->window->id()) != filtered_windows.end())590 if (!swin->window || filtered_windows.find(swin->window->id()) != filtered_windows.end())
591 continue;591 continue;
592592
593 auto* uwin = UnityWindow::get(swin->window);593 if (UnityWindow* uwin = UnityWindow::get(swin->window))
594 uwin->OnTerminateSpread();594 {
595 fake_decorated_windows_.erase(uwin);595 uwin->OnTerminateSpread();
596 fake_decorated_windows_.erase(uwin);
597 }
596 }598 }
597599
598 for (auto xid : filtered_windows)600 for (auto xid : filtered_windows)
@@ -606,6 +608,9 @@
606608
607 for (auto const& swin : sScreen->getWindows())609 for (auto const& swin : sScreen->getWindows())
608 {610 {
611 if (!swin->window)
612 continue;
613
609 auto* uwin = UnityWindow::get(swin->window);614 auto* uwin = UnityWindow::get(swin->window);
610 fake_decorated_windows_.insert(uwin);615 fake_decorated_windows_.insert(uwin);
611 uwin->OnInitiateSpread();616 uwin->OnInitiateSpread();
@@ -617,7 +622,13 @@
617 spread_widgets_.reset();622 spread_widgets_.reset();
618623
619 for (auto const& swin : sScreen->getWindows())624 for (auto const& swin : sScreen->getWindows())
620 UnityWindow::get(swin->window)->OnTerminateSpread();625 {
626 if (!swin->window)
627 continue;
628
629 if (UnityWindow* uwin = UnityWindow::get(swin->window))
630 uwin->OnTerminateSpread();
631 }
621632
622 fake_decorated_windows_.clear();633 fake_decorated_windows_.clear();
623}634}
@@ -3859,7 +3870,7 @@
38593870
3860 for (ScaleWindow *sw : scaled_windows)3871 for (ScaleWindow *sw : scaled_windows)
3861 {3872 {
3862 if (sw->window->outputDevice() == static_cast<int>(output.id()))3873 if (sw->window && sw->window->outputDevice() == static_cast<int>(output.id()))
3863 {3874 {
3864 UnityWindow::get(sw->window)->deco_win_->scaled = true;3875 UnityWindow::get(sw->window)->deco_win_->scaled = true;
3865 layout_windows.emplace_back(std::make_shared<LayoutWindow>(sw->window->id()));3876 layout_windows.emplace_back(std::make_shared<LayoutWindow>(sw->window->id()));