Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Unified Diff: ash/wm/frame_painter.cc

Issue 11194015: Fix crash bugs of FramePainter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/wm/frame_painter.cc
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index 1f77072d27f66c061ee5cba39fb61d2431b2fd6a..03bfe26472bda1edbec023b873e4ff755cc4551c 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -147,8 +147,15 @@ FramePainter::FramePainter()
FramePainter::~FramePainter() {
// Sometimes we are destroyed before the window closes, so ensure we clean up.
- if (window_)
+ if (window_) {
+ aura::RootWindow* root = window_->GetRootWindow();
+ if (root &&
+ root->GetProperty(internal::kSoloWindowFramePainterKey) == this) {
+ root->SetProperty(internal::kSoloWindowFramePainterKey,
+ static_cast<FramePainter*>(NULL));
+ }
window_->RemoveObserver(this);
+ }
instances_->erase(this);
}
@@ -755,12 +762,16 @@ void FramePainter::UpdateSoloWindowFramePainter(
internal::kSoloWindowFramePainterKey);
FramePainter* new_solo_painter = GetSoloPainterInRoot(ignorable_window);
if (old_solo_painter != new_solo_painter) {
- if (old_solo_painter)
+ if (old_solo_painter && old_solo_painter->frame_ &&
+ old_solo_painter->frame_->non_client_view()) {
old_solo_painter->frame_->non_client_view()->SchedulePaint();
+ }
window_->GetRootWindow()->SetProperty(
internal::kSoloWindowFramePainterKey, new_solo_painter);
- if (new_solo_painter)
+ if (new_solo_painter && new_solo_painter->frame_ &&
+ new_solo_painter->frame_->non_client_view()) {
new_solo_painter->frame_->non_client_view()->SchedulePaint();
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698