Chromium Code Reviews| Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| index 132cfa752546c0359294c145c05efe7c902d8986..8a04e2e1bce2a4aa028ae156ada11f351bd0e2a9 100644 |
| --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| @@ -1027,12 +1027,12 @@ void DesktopWindowTreeHostX11::FrameTypeChanged() { |
| // and does not change. |
| return; |
| } |
| - |
| - SetUseNativeFrame(new_type == Widget::FRAME_TYPE_FORCE_NATIVE); |
| - // Replace the frame and layout the contents. Even though we don't have a |
| - // swapable glass frame like on Windows, we still replace the frame because |
| - // the button assets don't update otherwise. |
| - native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame(); |
| + // Avoid mutating |View::children_| while possibly iterating over them. |
| + // See View::PropagateNativeThemeChanged(). |
| + base::ThreadTaskRunnerHandle::Get()->PostTask( |
| + FROM_HERE, base::Bind(&DesktopWindowTreeHostX11::DelayedChangeFrameType, |
| + close_widget_factory_.GetWeakPtr(), |
|
sadrul
2016/12/22 01:12:16
I think you want to use weak_factory_ here. |close
varkha
2016/12/22 01:22:52
Yeah, sorry, copy-paste only works most of the tim
varkha
2016/12/22 17:49:11
Done.
|
| + new_type)); |
| } |
| void DesktopWindowTreeHostX11::SetFullscreen(bool fullscreen) { |
| @@ -2279,6 +2279,14 @@ void DesktopWindowTreeHostX11::DelayedResize(const gfx::Size& size_in_pixels) { |
| delayed_resize_task_.Cancel(); |
| } |
| +void DesktopWindowTreeHostX11::DelayedChangeFrameType(Widget::FrameType type) { |
| + SetUseNativeFrame(type == Widget::FRAME_TYPE_FORCE_NATIVE); |
| + // Replace the frame and layout the contents. Even though we don't have a |
| + // swappable glass frame like on Windows, we still replace the frame because |
| + // the button assets don't update otherwise. |
| + native_widget_delegate_->AsWidget()->non_client_view()->UpdateFrame(); |
| +} |
| + |
| gfx::Rect DesktopWindowTreeHostX11::GetWorkAreaBoundsInPixels() const { |
| std::vector<int> value; |
| if (ui::GetIntArrayProperty(x_root_window_, "_NET_WORKAREA", &value) && |