HumbleUI / JWM

Cross-platform window management and OS integration library for Java
Apache License 2.0
571 stars 46 forks source link

Example segfaults on close on Linux #190

Closed dzaima closed 2 years ago

dzaima commented 2 years ago

The following fixes it:

diff --git a/examples/dashboard/java/Example.java b/examples/dashboard/java/Example.java
index ca847c9..bae392b 100644
--- a/examples/dashboard/java/Example.java
+++ b/examples/dashboard/java/Example.java
@@ -153,6 +153,7 @@ public class Example implements Consumer<Event> {
         if (e instanceof EventWindowClose) {
             if (App._windows.size() == 0)
                 App.terminate();
+            return;
         }

         panelTextInput.accept(e);

Does it not break on other OSes (should it not break)? Should there be some asserts to make sure you're not using things after termination?

tonsky commented 2 years ago

Thanks! No it doesn’t crash on macOS, but the change makes perfect sense