Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segfault on Linux within getAppWindowHandle #230

Open
JanezStupar opened this issue Sep 16, 2023 · 2 comments
Open

segfault on Linux within getAppWindowHandle #230

JanezStupar opened this issue Sep 16, 2023 · 2 comments

Comments

@JanezStupar
Copy link

Sometimes the app segfaults on startup.

I managed to trace it to within getAppWindowHandle call.

I can also report that it does not manifest when running with GDB or when running a debug build.

AddressSanitizer reports errors too.

I have neither time nor knowledge to pursue this further. But I can provide more debug information if necessary.

@JanezStupar
Copy link
Author

An update.

While there may be noncritical leaks... This seems to be some sort of race condition.

The following code helps prevent the crash:

  doWhenWindowReady(() {
    const initialSize = Size(360, 720);
    appWindow.minSize = initialSize;
    appWindow.size = initialSize;
    appWindow.alignment = Alignment.center;
    sleep(Duration(milliseconds: 100)); // This buys enough time to prevent crash
    appWindow.show();
  });

@JanezStupar
Copy link
Author

Closed the issue too soon when testing it turns out that I built the app in debug mode.

Apparently this helps mitigate the race condition too:

  runApp(MyApp(locale));
  doWhenWindowReady(() {
    const initialSize = Size(360, 720);
    appWindow.minSize = initialSize;
    appWindow.size = initialSize;
    appWindow.alignment = Alignment.center;
    appWindow.show();
  });
  sleep(Duration(milliseconds: 10));

@JanezStupar JanezStupar reopened this Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant