Skip to content

Commit 7fabdcd

Browse files
committed
Log error messages during window creation, window change, and destruction
1 parent 6bf2639 commit 7fabdcd

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

engine/src/flutter/shell/platform/windows/flutter_host_window_controller.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ FlutterHostWindowController::~FlutterHostWindowController() {
3939
std::optional<WindowMetadata> FlutterHostWindowController::CreateHostWindow(
4040
WindowCreationSettings const& settings) {
4141
auto window = std::make_unique<FlutterHostWindow>(this, settings);
42+
4243
if (!window->GetWindowHandle()) {
44+
FML_LOG(ERROR) << "Failed to create host window";
4345
return std::nullopt;
4446
}
4547

@@ -66,6 +68,7 @@ bool FlutterHostWindowController::ModifyHostWindow(
6668
WindowModificationSettings const& settings) const {
6769
FlutterHostWindow* const window = GetHostWindow(view_id);
6870
if (!window) {
71+
FML_LOG(ERROR) << "Failed to find window with view ID " << view_id;
6972
return false;
7073
}
7174

@@ -96,13 +99,16 @@ bool FlutterHostWindowController::ModifyHostWindow(
9699

97100
bool FlutterHostWindowController::DestroyHostWindow(
98101
FlutterViewId view_id) const {
99-
if (FlutterHostWindow* const window = GetHostWindow(view_id)) {
100-
// |window| will be removed from |windows_| when WM_NCDESTROY is handled.
101-
PostMessage(window->GetWindowHandle(), WM_CLOSE, 0, 0);
102-
103-
return true;
102+
FlutterHostWindow* const window = GetHostWindow(view_id);
103+
if (!window) {
104+
FML_LOG(ERROR) << "Failed to find window with view ID " << view_id;
105+
return false;
104106
}
105-
return false;
107+
108+
// |window| will be removed from |windows_| when WM_NCDESTROY is handled.
109+
PostMessage(window->GetWindowHandle(), WM_CLOSE, 0, 0);
110+
111+
return true;
106112
}
107113

108114
FlutterHostWindow* FlutterHostWindowController::GetHostWindow(

0 commit comments

Comments
 (0)