bugGNUstep - Bugs: bug #39290, EOModelEditor could not save a new...

Group
 
 

bug #39290: EOModelEditor could not save a new document

Submitter:  Graham Lee <leeg>
Submitted:  Wed 19 Jun 2013 02:46:08 PM UTC
   
 
Category:  gdl2 Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  buzzdee
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 23 Jun 2013 07:15:21 AM UTC, comment #3: 

after a discussion with David, and because it doesn't seem to break anything for me on OpenBSD the patch is now applied in SVN rev: 36745

thanks,
Sebastian

Sebastian Reitenbach <buzzdee>
Group Member
Sat 22 Jun 2013 04:21:43 PM UTC, comment #2: 

This is on the Mac. The symptoms for me are that saving does not work, and the Inspector is always blank because there is "No selection." If the selection in the outline view should represent the _eomodel ivar itself, an exception is raised because +[NSArray arrayWithObject: nil] is called.

I'm not sure why it'd work differently with -gui instead of AppKit. I couldn't readily see where the _eomodel ivar gets set up for a new document, perhaps I missed that being done somewhere that doesn't get called on the Apple platform.

Graham Lee <leeg>
Sat 22 Jun 2013 04:16:27 PM UTC, comment #1: 

For me, on OpenBSD, I can create a new model, and the
"save as" works for me as expected, saving the eomodel.

Besides I cannot reproduce the problem, it still works for me with your patch.
Where does the problem happen to you, on the MAC or with GNUstep?



Sebastian Reitenbach <buzzdee>
Group Member
Wed 19 Jun 2013 02:46:08 PM UTC, original submission:  

There are a couple of aspects to this fix:

 - on receiving -[EOMEDocument writeToURL:ofType:error:] the document would first try to copy its file URL to the destination, then it would try to write the EOModel to the destination (which would override the first activity). However, the -fileURL for a new, never before saved document is nil, so an exception was raised that caused saving to fail.
 - new, untitled documents don't have a _eomodel, which means that saving wouldn't do anything anyway. This also introduces a lot of other bugs working with documents created with file->new, particularly related to setting the outline view selection.

This patch addresses both of these issues. It also removes a conditional check for -gui vs. AppKit, because the referenced bug in -gui has since been closed.


Index: Apps/EOModelEditor/EOMEDocument.m
===================================================================
--- Apps/EOModelEditor/EOMEDocument.m (revision 36732)
+++ Apps/EOModelEditor/EOMEDocument.m (working copy)
@@ -69,6 +69,15 @@
 //  [storedProceduresItem retain];
 }
 
+- (id) init
+{
+  self = [super init];
+  if (self)
+    {
+      _eomodel = [EOModel new];
+    }
+  return self;
+}
 
 - (void) dealloc
 {
@@ -446,22 +455,8 @@
   NSLog(@"%s:%@", _PRETTY_FUNCTION_, typeName);
 
   NS_DURING {
-   
-#ifdef GNUSTEP
-
-#warning "see http://savannah.gnu.org/bugs/index.php?30348"
-#else   
-    NSFileManager * manager = [NSFileManager defaultManager];
-   
-    [manager copyItemAtURL:[self fileURL]
-                     toURL:absoluteURL error:outError];
-   
-#endif

-  [_eomodel writeToFile: [absoluteURL path]];

+    [_eomodel writeToFile: [absoluteURL path]];
   } NS_HANDLER {
-   
     NSDictionary *userInfo = [NSDictionary dictionaryWithObject:[localException reason]
                                 forKey:NSLocalizedDescriptionKey];
 
@@ -470,8 +465,6 @@
                                 userInfo:userInfo];
     return NO;
   } NS_ENDHANDLER;
-  // 'file://localhost/Users/dave/dev/PBXBilling/trunk/PBX.eomodeld/'
-  // NSLog(@"fileURL '%@'", [self fileURL]);
   return YES;
 }
 

Graham Lee <leeg>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by buzzdee (Posted a comment)
  • -email is unavailable- added by leeg (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-06-23 buzzdee StatusNone Fixed
        Assigned toNone buzzdee
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code