ApplicationModel.st
changeset 786 91d5639d9999
parent 770 86ff2c263a8d
child 787 fced0a358392
--- a/ApplicationModel.st	Wed Jan 28 17:42:48 1998 +0100
+++ b/ApplicationModel.st	Thu Jan 29 10:49:13 1998 +0100
@@ -1360,10 +1360,27 @@
 
 closeRequest
     "this is sent by my topView when about to be closed
-     by the program (not by the windowManager).
+     by the windowManager.
      Could be redefined in subclasses to suppress close or confirm."
 
-    self closeDownViews
+    |sav|
+
+    masterApplication notNil ifTrue:[
+
+        "/ temporary clear my masterApplication to prevent
+        "/ endless recursion, in case the master sends me
+        "/ a closeRequest (although, it is supposed to
+        "/ send me a closeDownViews ...)
+
+        sav := masterApplication.
+        masterApplication := nil.
+        masterApplication closeRequestFor:(self window).
+
+        "/ restore - in case master did not want me to close ...
+        masterApplication := sav.
+    ] ifFalse:[
+        self closeDownViews
+    ].
 
     "Modified: 4.3.1997 / 00:48:15 / cg"
 !
@@ -1371,11 +1388,29 @@
 closeRequestFor:aTopView
     "this is sent by any of my topViews when about to be closed by the
      windowmanager. For backward compatibility with single-view applications,
-     this is forwarded here to a simple (non topView-specific) closeRequest.
+     this is forwarded here to a simple (non topView-specific) closeRequest,
+     effectively closing all of my views.
      MultiView applications should redefine this method if closing of individual
-     views closing is to be caught."
+     views closing is to be caught and/or should not close all of them."
+
+    |sav|
+
+    masterApplication notNil ifTrue:[
 
-    ^ self closeRequest
+        "/ temporary clear my masterApplication to prevent
+        "/ endless recursion, in case the master sends me
+        "/ a closeRequest (although, it is supposed to
+        "/ send me a closeDownViews ...)
+
+        sav := masterApplication.
+        masterApplication := nil.
+        masterApplication closeRequestFor:(self window).
+
+        "/ restore - in case master did not want me to close ...
+        masterApplication := sav.
+    ] ifFalse:[
+        self closeRequest
+    ]
 !
 
 open
@@ -1568,6 +1603,6 @@
 !ApplicationModel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.67 1998-01-25 18:47:45 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.68 1998-01-29 09:49:13 ca Exp $'
 ! !
 ApplicationModel initialize!