Author: fredkiefer
Date: Mon Jul 21 10:04:32 2014
New Revision: 38003

URL: http://svn.gna.org/viewcvs/gnustep?rev=38003&view=rev
Log:
* Source/NSBox.m (-calcSizesAllowingNegative): Protect against
  _cell being nil.
* Source/NSBox.m (-initWithCoder:): Add a few default values.
* Source/NSMenu.m (-_setGeometry): Protect against _aWindow
  being nil.

Modified:
    libs/gui/trunk/ChangeLog
    libs/gui/trunk/Source/NSBox.m
    libs/gui/trunk/Source/NSMenu.m

Modified: libs/gui/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/ChangeLog?rev=38003&r1=38002&r2=38003&view=diff
==============================================================================
--- libs/gui/trunk/ChangeLog    (original)
+++ libs/gui/trunk/ChangeLog    Mon Jul 21 10:04:32 2014
@@ -1,3 +1,10 @@
+2014-07-04  Fred Kiefer <[email protected]>
+
+       * Source/NSBox.m (-calcSizesAllowingNegative): Protect against
+       _cell being nil.
+       * Source/NSBox.m (-initWithCoder:): Add a few default values.
+       * Source/NSMenu.m (-_setGeometry): Protect against _aWindow being nil.
+
 2014-07-04  Fred Kiefer <[email protected]>
 
        * Source/GSWindowDecorationView.m (-changeWindowHeight:): Add

Modified: libs/gui/trunk/Source/NSBox.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSBox.m?rev=38003&r1=38002&r2=38003&view=diff
==============================================================================
--- libs/gui/trunk/Source/NSBox.m       (original)
+++ libs/gui/trunk/Source/NSBox.m       Mon Jul 21 10:04:32 2014
@@ -572,6 +572,10 @@
 
           [self setBorderType: borderType];
         }
+      else
+        {
+          _border_type = NSGrooveBorder;
+        }
       if ([aDecoder containsValueForKey: @"NSTitlePosition"])
         {
           NSTitlePosition titlePosition = [aDecoder decodeIntForKey: 
@@ -579,6 +583,10 @@
           
           [self setTitlePosition: titlePosition];
         }
+      else
+        {
+          _title_position = NSAtTop;
+        }
       if ([aDecoder containsValueForKey: @"NSTransparent"])
         {
           // On Apple this is always NO, we keep it for old GNUstep archives
@@ -598,11 +606,26 @@
           
           ASSIGN(_cell, titleCell);
         }
+      else
+        {
+          _cell = [[NSCell alloc] initTextCell: @"Title"];
+          [_cell setAlignment: NSCenterTextAlignment];
+          [_cell setBordered: NO];
+          [_cell setEditable: NO];
+          [self setTitleFont: [NSFont systemFontOfSize:
+                                        [NSFont smallSystemFontSize]]];
+        }
       if ([aDecoder containsValueForKey: @"NSContentView"])
         {
           NSView *contentView = [aDecoder decodeObjectForKey: 
@"NSContentView"];
 
           [self setContentView: contentView];
+        }
+      else
+        {
+          NSView *cv = [NSView new];
+          [self setContentView: cv];
+          RELEASE(cv);
         }
     }
   else
@@ -661,6 +684,12 @@
        }
       return r;
     }                          
+
+  // Don't try to compute anything while the title cell hasn't been set.
+  if (_cell == nil)
+    {
+      return r;
+    }
 
   switch (_title_position)
     {

Modified: libs/gui/trunk/Source/NSMenu.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSMenu.m?rev=38003&r1=38002&r2=38003&view=diff
==============================================================================
--- libs/gui/trunk/Source/NSMenu.m      (original)
+++ libs/gui/trunk/Source/NSMenu.m      Mon Jul 21 10:04:32 2014
@@ -501,11 +501,14 @@
            }
        }
       
-      origin = NSMakePoint(0, [[_aWindow screen] visibleFrame].size.height 
-         - [_aWindow frame].size.height);
+      if ((_aWindow != nil) && ([_aWindow screen] != nil))
+        {
+          origin = NSMakePoint(0, [[_aWindow screen] visibleFrame].size.height 
+                               - [_aWindow frame].size.height);
          
-      [_aWindow setFrameOrigin: origin];
-      [_bWindow setFrameOrigin: origin];
+          [_aWindow setFrameOrigin: origin];
+          [_bWindow setFrameOrigin: origin];
+        }
     }
 }
 


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to