Skip to content

Commit deb8dbc

Browse files
authored
Prevent plugin to be reregistered when spawning subwindow (#80)
1 parent 8db2bc9 commit deb8dbc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/tray_manager/windows/tray_manager_plugin.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,18 @@ class TrayManagerPlugin : public flutter::Plugin {
8989
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
9090
};
9191

92+
static bool plugin_already_registered = false;
93+
9294
// static
9395
void TrayManagerPlugin::RegisterWithRegistrar(
9496
flutter::PluginRegistrarWindows* registrar) {
97+
if (plugin_already_registered) {
98+
// Skip registration in subwindow
99+
return;
100+
}
101+
102+
plugin_already_registered = true;
103+
95104
channel = std::make_unique<flutter::MethodChannel<flutter::EncodableValue>>(
96105
registrar->messenger(), "tray_manager",
97106
&flutter::StandardMethodCodec::GetInstance());

0 commit comments

Comments
 (0)