diff --git a/example/windows/flutter/CMakeLists.txt b/example/windows/flutter/CMakeLists.txt index d4b5770..e710741 100644 --- a/example/windows/flutter/CMakeLists.txt +++ b/example/windows/flutter/CMakeLists.txt @@ -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") @@ -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 $ + ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS diff --git a/windows/window_manager_plugin.cpp b/windows/window_manager_plugin.cpp index 7505025..51db8f7 100644 --- a/windows/window_manager_plugin.cpp +++ b/windows/window_manager_plugin.cpp @@ -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);