fix: fix cast in ElectronDesktopWindowTreeHostLinux (#42179)
Fix cast in ElectronDesktopWindowTreeHostLinux The frame view of the widget is an `ClientFrameViewLinux` instance only when both `frame` and `client_frame` booleans are set to `true`. Otherwise it is an instance of a different class and thus casting to `ClientFrameViewLinux` is incorrect and leads to crashes. Fix: #41839
This commit is contained in:
parent
d0cb298f95
commit
f2af35182c
1 changed files with 9 additions and 3 deletions
|
@ -87,9 +87,15 @@ void ElectronDesktopWindowTreeHostLinux::OnWindowStateChanged(
|
||||||
|
|
||||||
void ElectronDesktopWindowTreeHostLinux::OnWindowTiledStateChanged(
|
void ElectronDesktopWindowTreeHostLinux::OnWindowTiledStateChanged(
|
||||||
ui::WindowTiledEdges new_tiled_edges) {
|
ui::WindowTiledEdges new_tiled_edges) {
|
||||||
|
// CreateNonClientFrameView creates `ClientFrameViewLinux` only when both
|
||||||
|
// frame and client_frame booleans are set, otherwise it is a different type
|
||||||
|
// of view.
|
||||||
|
if (native_window_view_->has_frame() &&
|
||||||
|
native_window_view_->has_client_frame()) {
|
||||||
static_cast<ClientFrameViewLinux*>(
|
static_cast<ClientFrameViewLinux*>(
|
||||||
native_window_view_->widget()->non_client_view()->frame_view())
|
native_window_view_->widget()->non_client_view()->frame_view())
|
||||||
->set_tiled_edges(new_tiled_edges);
|
->set_tiled_edges(new_tiled_edges);
|
||||||
|
}
|
||||||
UpdateFrameHints();
|
UpdateFrameHints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue