Closed ljnhst closed 4 months ago
在WindowManagerPlugin析构时应将channel置为空指针。在析构之后还传递窗口消息,在invokeMethod方法内会出现messenger_指针异常问题。复现方法为在退出应用前调用关闭窗口的方法,再退出应用。
下面为我解决该问题添加的指针处理:
WindowManagerPlugin::~WindowManagerPlugin() { registrar->UnregisterTopLevelWindowProcDelegate(window_proc_id); channel = nullptr; } void WindowManagerPlugin::_EmitEvent(std::string eventName) { if (channel) { flutter::EncodableMap args = flutter::EncodableMap(); args[flutter::EncodableValue("eventName")] = flutter::EncodableValue(eventName); channel->InvokeMethod("onEvent", std::make_unique<flutter::EncodableValue>(args)); } }
Fixed in this commit https://github.com/leanflutter/window_manager/commit/8fa23db7f4c2cf8cf3085d5fc06e4ceb7857a2f5
在WindowManagerPlugin析构时应将channel置为空指针。在析构之后还传递窗口消息,在invokeMethod方法内会出现messenger_指针异常问题。复现方法为在退出应用前调用关闭窗口的方法,再退出应用。
下面为我解决该问题添加的指针处理: