Revision: 29386
          http://sourceforge.net/p/bibdesk/svn/29386
Author:   hofman
Date:     2025-07-28 14:48:33 +0000 (Mon, 28 Jul 2025)
Log Message:
-----------
allow fragile cite key characters when closing window, should not happen anyway

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

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2025-07-28 14:38:09 UTC (rev 29385)
+++ trunk/bibdesk/BDSKEditor.m  2025-07-28 14:48:33 UTC (rev 29386)
@@ -2909,11 +2909,25 @@
     }
 }
 
+- (void)endEditing {
+    if (editorFlags.isEditing == NO)
+        return;
+    NSError *error = nil;
+    if (NO == [self commitEditingAndReturnError:&error])
+        return;
+    if ([error localizedRecoveryOptions]) {
+        editorFlags.allowFragileCharacters = YES;
+        BOOL didEndEditing = [self commitEditingAndReturnError:NULL];
+        editorFlags.allowFragileCharacters = NO;
+        if (didEndEditing)
+            return;
+    }
+    [self discardEditing];
+}
+
 - (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
-    if (editorFlags.isEditing && [self commitEditingAndReturnError:NULL] == NO)
-        [self discardEditing];
-    [self setEditing:NO];
+    [self endEditing];
     
     editorFlags.isEditable = NO;
     
@@ -2939,11 +2953,8 @@
 
 - (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 && editorFlags.isEditing) {
-        if ([self commitEditingAndReturnError:NULL] == NO)
-            [self discardEditing];
-        [self setEditing:NO];
-    }
+    if ([self document] && document == nil && editorFlags.isEditing)
+        [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
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to