Skip to content

Commit

Permalink
fix: crash after deconstruction #423
Browse files Browse the repository at this point in the history
  • Loading branch information
lijy91 committed May 18, 2024
1 parent e077e8e commit 8fa23db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion example/windows/flutter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
# https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")

# Set fallback configurations for older versions of the flutter tool.
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
set(FLUTTER_TARGET_PLATFORM "windows-x64")
endif()

# === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")

Expand Down Expand Up @@ -91,7 +96,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG>
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
Expand Down
2 changes: 2 additions & 0 deletions windows/window_manager_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ WindowManagerPlugin::WindowManagerPlugin(

WindowManagerPlugin::~WindowManagerPlugin() {
registrar->UnregisterTopLevelWindowProcDelegate(window_proc_id);
channel = nullptr;
}

void WindowManagerPlugin::_EmitEvent(std::string eventName) {
if (channel == nullptr) return;
flutter::EncodableMap args = flutter::EncodableMap();
args[flutter::EncodableValue("eventName")] =
flutter::EncodableValue(eventName);
Expand Down

0 comments on commit 8fa23db

Please sign in to comment.