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

Cannot create/quit window multiple times on Linux! #205

Closed
AndyObtiva opened this issue May 14, 2023 · 3 comments
Closed

Cannot create/quit window multiple times on Linux! #205

AndyObtiva opened this issue May 14, 2023 · 3 comments

Comments

@AndyObtiva
Copy link
Contributor

AndyObtiva commented May 14, 2023

Hi,

I got multiple issue reports on the Glimmer DSL for LibUI project about not being able to create/quit a main window multiple times on Linux (getting a segfault):

I confirmed that this works correctly on the Mac though. I am able to create a window, start the main event loop. quit the LibUI event loop, create another window, restart the main event loop, and finally quit again.

So, this seems like a Linux issue only. It is problametic because it prevents users from being able to launch/close/relaunch windows in the same Ruby application. To get around it, they could script multiple Ruby applications I suppose, but it would be great if libui-ng behaved consistently in Linux and Mac with regards to being able to launch a window multiple times.

If you need further information about the issue, please let me know.

Thank you in any case for continuing to maintain libui-ng. It's a very convenient cross-platform GUI library.

@cody271
Copy link
Contributor

cody271 commented May 14, 2023

create a window, start the main event loop. quit the LibUI event loop, create another window, restart the main event loop, and finally quit again.

This appears to be a Ruby FFI bug on Linux..

I cannot reproduce with C equivalent, try this simple modification to hello-world example:

diff --git a/examples/hello-world/main.c b/examples/hello-world/main.c
index 85658042..4471ba85 100644
--- a/examples/hello-world/main.c
+++ b/examples/hello-world/main.c
@@ -30,6 +30,17 @@ int main(void)
 
        uiControlShow(uiControl(w));
        uiMain();
+
+       // Create a new window
+       w = uiNewWindow("Hello World!", 300, 30, 0);
+       uiWindowOnClosing(w, onClosing, NULL);
+
+       l = uiNewLabel("Hello, World!");
+       uiWindowSetChild(w, uiControl(l));
+
+       uiControlShow(uiControl(w));
+       uiMain();
+
        uiUninit();
        return 0;
 }

@AndyObtiva
Copy link
Contributor Author

OK, thank you for confirming. I should have checked with the Ruby FFI binding project first. I initially did run my own tests with the Ruby FFI binding low-level code and confirmed the issue was there, but I mistakenly concluded the issue was caused by the C libui project.

In any case, I reported it to the LibUI Ruby FFI project:
kojix2/LibUI#45

I will close this issue for now given you confirmed that it cannot be reproduced in C libui code.

@kojix2
Copy link
Contributor

kojix2 commented May 15, 2023

Thanks @cody271 for looking into the issue.
I will try to look into the cause of this problem.

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

3 participants