Index: GormCore/GormGenericEditor.h
===================================================================
--- GormCore/GormGenericEditor.h	(revision 26932)
+++ GormCore/GormGenericEditor.h	(working copy)
@@ -81,6 +81,7 @@
 
 // private methods...
 @interface GormGenericEditor (PrivateMethods)
+- (void) willCloseDocument: (NSNotification *) aNotification;
 - (void) groupSelectionInScrollView;
 - (void) groupSelectionInSplitView;
 - (void) groupSelectionInBox;
Index: GormCore/GormGenericEditor.m
===================================================================
--- GormCore/GormGenericEditor.m	(revision 26932)
+++ GormCore/GormGenericEditor.m	(working copy)
@@ -122,6 +122,11 @@
   return YES;
 }
 
+- (void) willCloseDocument: (NSNotification *)aNotification
+{
+  document = nil;
+}
+
 - (void) close
 {
   if(closed == NO)
@@ -147,11 +152,18 @@
 {
   if((self = [super init]) != nil)
     {
-      // don't retain the document...
+      /* don't retain the document... */
       document = aDocument;
       closed = NO;
       activated = NO;
       resourceManager = nil;      
+      /* since we don't retain the document handle its close notifications */
+      [[NSNotificationCenter defaultCenter]
+	addObserver: self
+	selector: @selector(willCloseDocument:)
+	name: IBWillCloseDocumentNotification
+	object: document];
+	  
     }
   return self;
 }
Index: GormCore/GormImageEditor.m
===================================================================
--- GormCore/GormImageEditor.m	(revision 26932)
+++ GormCore/GormImageEditor.m	(working copy)
@@ -118,8 +118,8 @@
 
 - (void) dealloc
 {
-  // if(closed == NO)
-  //   [self close];
+  if(closed == NO)
+    [self close];
 
   // It is not necessary to call super dealloc here.
   // images are cached throughout the lifetime of the app.
@@ -132,6 +132,12 @@
   [super dealloc];
 }
 
+- (void) willCloseDocument: (NSNotification *)aNotification
+{
+  NSMapRemove(docMap,document);
+  [super willCloseDocument: aNotification];
+}
+
 - (void) close
 {
   [super close];
Index: GormCore/GormSoundEditor.m
===================================================================
--- GormCore/GormSoundEditor.m	(revision 26932)
+++ GormCore/GormSoundEditor.m	(working copy)
@@ -116,6 +116,12 @@
   return self;
 }
 
+- (void) willCloseDocument: (NSNotification *)aNotification
+{
+  NSMapRemove(docMap,document);
+  [super willCloseDocument: aNotification];
+}
+
 - (void) close
 {
   [super close];
Index: GormCore/GormObjectEditor.m
===================================================================
--- GormCore/GormObjectEditor.m	(revision 26932)
+++ GormCore/GormObjectEditor.m	(working copy)
@@ -407,11 +407,17 @@
   return self;
 }
 
+- (void) willCloseDocument: (NSNotification *)aNotification
+{
+  NSMapRemove(docMap,document);
+  [super willCloseDocument: aNotification];
+}
+
 - (void) close
 {
-  // [super close];
+  [super close];
   [[NSNotificationCenter defaultCenter] removeObserver: self];
-  // NSMapRemove(docMap,document);
+  NSMapRemove(docMap,document);
 }
 
 - (void) makeSelectionVisible: (BOOL)flag
