#51 working OK
[fanfix.git] / src / jexer / TApplication.java
index 14ebacda7f4fa0a645c0958018d1bb8871f332e9..affc6ce4d1487118a23aa30d5673ad23c648f409 100644 (file)
@@ -869,6 +869,11 @@ public class TApplication implements Runnable {
         // resources.
         closeAllWindows();
 
+        // Close the desktop.
+        if (desktop != null) {
+            setDesktop(null);
+        }
+
         // Give the overarching application an opportunity to release
         // resources.
         onExit();
@@ -1611,6 +1616,8 @@ public class TApplication implements Runnable {
      */
     public final void setDesktop(final TDesktop desktop) {
         if (this.desktop != null) {
+            this.desktop.onPreClose();
+            this.desktop.onUnfocus();
             this.desktop.onClose();
         }
         this.desktop = desktop;