Skip to content

Commit 8fa23db

Browse files
committed
fix: crash after deconstruction #423
1 parent e077e8e commit 8fa23db

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

example/windows/flutter/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
99
# https://github.com/flutter/flutter/issues/57146.
1010
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
1111

12+
# Set fallback configurations for older versions of the flutter tool.
13+
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
14+
set(FLUTTER_TARGET_PLATFORM "windows-x64")
15+
endif()
16+
1217
# === Flutter Library ===
1318
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
1419

@@ -91,7 +96,7 @@ add_custom_command(
9196
COMMAND ${CMAKE_COMMAND} -E env
9297
${FLUTTER_TOOL_ENVIRONMENT}
9398
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
94-
windows-x64 $<CONFIG>
99+
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
95100
VERBATIM
96101
)
97102
add_custom_target(flutter_assemble DEPENDS

windows/window_manager_plugin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ WindowManagerPlugin::WindowManagerPlugin(
9292

9393
WindowManagerPlugin::~WindowManagerPlugin() {
9494
registrar->UnregisterTopLevelWindowProcDelegate(window_proc_id);
95+
channel = nullptr;
9596
}
9697

9798
void WindowManagerPlugin::_EmitEvent(std::string eventName) {
99+
if (channel == nullptr) return;
98100
flutter::EncodableMap args = flutter::EncodableMap();
99101
args[flutter::EncodableValue("eventName")] =
100102
flutter::EncodableValue(eventName);

0 commit comments

Comments
 (0)