flutter-plugins icon indicating copy to clipboard operation
flutter-plugins copied to clipboard

App crashes on closing child window when using window_manager (windows 10)

Open sleddev opened this issue 3 years ago • 19 comments

Whenever I try to use the window_manager package, the app crashes as soon as I try to interact with the main window after closing a child window. Both in debug and release mode.

I'm using Flutter 3.3.8 stable.

I attached the minimal code to reproduce: window_manager_crash.zip

sleddev avatar Nov 28 '22 21:11 sleddev

Maybe take a look at https://github.com/Kingtous/rustdesk_desktop_multi_window

damywise avatar Dec 12 '22 14:12 damywise

I just tried it with my attached example, and it crashed exactly the same.

sleddev avatar Dec 12 '22 15:12 sleddev

not sure what you mean by tried it, maybe look at the example and see how they used it

damywise avatar Dec 12 '22 15:12 damywise

Both the desktop_multi_window and rustsesk_desktop_multi_window plugins' examples crash after I click on the create a new world button

sleddev avatar Dec 12 '22 15:12 sleddev

weird, mine works perfectly

damywise avatar Dec 12 '22 16:12 damywise

I'll have to try it on another system or a VM then, but I can't do that until probably a few weeks.

sleddev avatar Dec 12 '22 16:12 sleddev

Can I ask what version of Flutter are you using?

sleddev avatar Dec 12 '22 16:12 sleddev

Flutter 3.3.9

damywise avatar Dec 13 '22 01:12 damywise

I successfully reproduced this problem using Flutter 3.7.0-1.1.pre (beta) test OS: Windows 11

SiongSng avatar Dec 13 '22 10:12 SiongSng

But if you don't use the window_manager package, it can work normally

SiongSng avatar Dec 13 '22 10:12 SiongSng

I am having the same issue as @CroatianHusky. Do we need to do any plugin cleanup in FlutterWindow::OnDestroy?

Flutter 3.7.0-19.0.pre, on Microsoft Windows [Version 10.0.19045.2486]

rashcroft7 avatar Feb 15 '23 00:02 rashcroft7

I am having the same issue as @CroatianHusky. Do we need to do any plugin cleanup in FlutterWindow::OnDestroy?

Flutter 3.7.0-19.0.pre, on Microsoft Windows [Version 10.0.19045.2486]

you can close child window by windowManager.destroy()

jijibong avatar Mar 10 '23 04:03 jijibong

I used the windowManager.destroy() to close the sub window, but it still make the main window crash, so now I currently just hide the sub window, not close it, everything goes on.

annd22 avatar Apr 15 '23 15:04 annd22

For those still having trouble, I am no longer getting errors using rustdesk_window_manager with rustdesk_desktop_multi_window

  window_manager:
        git:
            url: https://github.com/Kingtous/rustdesk_window_manager
            ref: 32b24c66151b72bba033ef8b954486aa9351d97b

  desktop_multi_window:
    git:
        url: https://github.com/Kingtous/rustdesk_desktop_multi_window
        ref: bc8604a88e52b2b6e64d2661ae49a71450a47af8

rashcroft7 avatar Apr 20 '23 10:04 rashcroft7

@rashcroft7 All you need to do is import those packages ? Do you know if you can change the transparency of new window ?

LucaCoduriV avatar May 02 '23 18:05 LucaCoduriV

@LucaCoduriV Yes, and follow the example usage at rustdesk_desktop_multi_window. You will need to look at how the sub window is closed in the main.dart.

I have not tried transparency.

rashcroft7 avatar May 02 '23 22:05 rashcroft7

@LucaCoduriV Yes, and follow the example usage at rustdesk_desktop_multi_window. You will need to look at how the sub window is closed in the main.dart.

I have not tried transparency.

I am looking at their code, but I Don't understand where I have to look. Sometime my program randomly crashes when opening a window after closing an other one and says that I am trying to read a Null pointer. And by the way, I can confirm that transparency works.

LucaCoduriV avatar May 03 '23 12:05 LucaCoduriV

I have the sameee. did you solve it?

@LucaCoduriV Yes, and follow the example usage at rustdesk_desktop_multi_window. You will need to look at how the sub window is closed in the main.dart. I have not tried transparency.

I am looking at their code, but I Don't understand where I have to look. Sometime my program randomly crashes when opening a window after closing an other one and says that I am trying to read a Null pointer. And by the way, I can confirm that transparency works.

abldabl avatar May 05 '23 09:05 abldabl

I have the sameee. did you solve it?

I am looking at their code, but I Don't understand where I have to look. Sometime my program randomly crashes when opening a window after closing an other one and says that I am trying to read a Null pointer. And by the way, I can confirm that transparency works.

No I didn't but i found a solution for my use case. I've created a pool of windows and hide them all by default. Then when I need, I change the content and show them up. And by the way, I am using the officials packages again.

LucaCoduriV avatar May 05 '23 14:05 LucaCoduriV