leanflutter / window_manager

This plugin allows Flutter desktop apps to resizing and repositioning the window.
https://pub.dev/packages/window_manager
MIT License
689 stars 188 forks source link

windowManager.destroy() takes several seconds to complete with Flutter 3.24.0 #478

Open TomKrauss opened 1 month ago

TomKrauss commented 1 month ago

We use windowManager.destroy() in our application to shut down. This worked smoothly in the past and now with the upgrade to Flutter 3.24.0 it takes several seconds to complete and to finally shutdown the application.

Tested on Windows.

li9chuan commented 1 month ago

I've encountered the same issue. The windowManager.destroy() method is taking several seconds to complete the shutdown process after upgrading to Flutter 3.24.0 on Windows. Previously, it worked smoothly and completed much faster.

azlekov commented 1 month ago

Same issue! Any workaround or how you approach this guys @TomKrauss, @li9chuan?

TomKrauss commented 1 month ago

Unfortunately no.

li9chuan commented 4 weeks ago

The Flutter version has been rolled back to 3.22.3, and window_manager has also been downgraded to 0.3.9 because of issue 483. @azlekov

WinXaito commented 2 weeks ago

Same issue! Any workaround or how you approach this guys @TomKrauss, @li9chuan?

@azlekov I encoutered the same problem. For the moment, I added exit(0); after calling await windowManager.destroy();

So, like that the function onWindowClose() is still called and completed, and with the exit(0);, the app is instantly closed after. Maybe not the best solution, but I didn't encoure any problem at this time.

@override
void onWindowClose() async {
  bool isPreventClose = await windowManager.isPreventClose();
  if (isPreventClose) {
    // ... disposing all my componenents, upgrade prefs, etc.

    // Close app
    await windowManager.destroy();
    exit(0);
  }
}