Revision: 27418
          http://sourceforge.net/p/bibdesk/svn/27418
Author:   hofman
Date:     2022-05-14 13:55:03 +0000 (Sat, 14 May 2022)
Log Message:
-----------
don't use separate method to force end editing, it is short

Modified Paths:
--------------
    trunk/bibdesk/BDSKEditor.m

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2022-05-14 13:50:53 UTC (rev 27417)
+++ trunk/bibdesk/BDSKEditor.m  2022-05-14 13:55:03 UTC (rev 27418)
@@ -469,14 +469,6 @@
     return YES;
 }
 
-- (void)forceCommitEditing {
-    if ([[[self window] firstResponder] isKindOfClass:[NSText class]] &&
-        NO == [[self window] makeFirstResponder:[self window]])
-        [self discardEditing];
-    else
-        [self endEditing];
-}
-
 #pragma mark Actions
 
 - (IBAction)copy:(id)sender {
@@ -2997,8 +2989,12 @@
 
 - (void)windowWillClose:(NSNotification *)notification{
     // make sure we're not registered as editor because we will be invalid, 
this shouldn't be necessary but there have been reports of crashes
-    [self forceCommitEditing];
-       
+    if ([[[self window] firstResponder] isKindOfClass:[NSText class]] &&
+        NO == [[self window] makeFirstResponder:[self window]])
+        [self discardEditing];
+    else
+        [self endEditing];
+    
     // see method for notes
     [self breakTextStorageConnections];
     
@@ -3030,8 +3026,13 @@
 
 - (void)setDocument:(NSDocument *)document {
     // in case the document is reset before windowWillClose: is called, I 
think this can happen on Tiger
-    if ([self document] && document == nil)
-        [self forceCommitEditing];
+    if ([self document] && document == nil && editorFlags.isEditing) {
+        if ([[[self window] firstResponder] isKindOfClass:[NSText class]] &&
+            NO == [[self window] makeFirstResponder:[self window]])
+            [self discardEditing];
+        else
+            [self endEditing];
+    }
     [super setDocument:document];
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to