Revision: 28686
          http://sourceforge.net/p/bibdesk/svn/28686
Author:   hofman
Date:     2024-01-28 00:01:57 +0000 (Sun, 28 Jan 2024)
Log Message:
-----------
Make sure createFilesArray is called only the first time the item owner is set. 
It can be set multiple times, e.g. with an undo of a remove.

Modified Paths:
--------------
    trunk/bibdesk/BibItem.h
    trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BibItem.h
===================================================================
--- trunk/bibdesk/BibItem.h     2024-01-27 23:20:47 UTC (rev 28685)
+++ trunk/bibdesk/BibItem.h     2024-01-28 00:01:57 UTC (rev 28686)
@@ -123,6 +123,7 @@
     NSURL *identifierURL;
     NSMutableArray *files;
     NSMutableArray *downloads;
+    BOOL createdFilesArray;
 }
 
 @property (class, nonatomic, readonly) NSString *defaultCiteKey;

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2024-01-27 23:20:47 UTC (rev 28685)
+++ trunk/bibdesk/BibItem.m     2024-01-28 00:01:57 UTC (rev 28686)
@@ -4092,7 +4092,10 @@
 }
 
 - (void)createFilesArray
-{        
+{
+    if (createdFilesArray)
+        return;
+    
     NSUInteger i = 1;
     NSString *value, *key = @"Bdsk-File-1";
     
@@ -4152,6 +4155,8 @@
             [pubFields setObject:[unresolvedURLs objectAtIndex:i] 
forKey:[NSString stringWithFormat:@"Bdsk-Url-%lu", (unsigned long)(i + 1)]];
     }
     
+    createdFilesArray = YES;
+    
     NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
     
     if (0 == [files count] && [sud boolForKey:BDSKUseLocalUrlAndUrlKey] == NO 
&& [sud boolForKey:BDSKAutomaticallyConvertURLFieldsKey] && [[self owner] 
isDocument]) {

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