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

Unified Diff: ui/views/widget/widget.cc

Issue 2703933002: Fix a crash due to reentrancy in the widget while processing a theme changed notification after com… (Closed)
Patch Set: Use AutoReset Created 3 years, 10 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
« no previous file with comments | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget.cc
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 6063a224684cb38ec980a29621197060167065c1..7e9fdb64bb125b795fab8b11f00478828d40a9cd 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -4,6 +4,7 @@
#include "ui/views/widget/widget.h"
+#include "base/auto_reset.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
@@ -174,7 +175,8 @@ Widget::Widget()
auto_release_capture_(true),
views_with_layers_dirty_(false),
movement_disabled_(false),
- observer_manager_(this) {}
+ observer_manager_(this),
+ processing_theme_changed_(false) {}
Widget::~Widget() {
DestroyRootView();
@@ -898,6 +900,8 @@ void Widget::DebugToggleFrameType() {
}
void Widget::FrameTypeChanged() {
+ if (processing_theme_changed_)
+ return;
native_widget_->FrameTypeChanged();
}
@@ -1401,6 +1405,10 @@ void Widget::OnNativeThemeUpdated(ui::NativeTheme* observed_theme) {
observer_manager_.Add(current_native_theme);
}
+ DCHECK_EQ(processing_theme_changed_, false);
+
+ base::AutoReset<bool> auto_theme_changed_recursion_break(
+ &processing_theme_changed_, true);
root_view_->PropagateNativeThemeChanged(current_native_theme);
}
« no previous file with comments | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698