[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unable to open .gorm files
From: |
Nicola Pero |
Subject: |
Re: Unable to open .gorm files |
Date: |
Mon, 25 Feb 2002 17:55:31 +0000 (GMT) |
> Hi,
>
> I noticed, that Gorm is unable to open some .gorm files, even its
> GormButtonInspector.gorm. Gorm will finish with an
> InternalInconsistencyException: expected int and got object. This bug remains
> also after recompiling GS and Gorm (current CVS version).
>
> So i think, it is in some encode.../initWithCoder: method. I am not really
> sure, but as I was looking at ChangeLog file (Feb 23), ant there is, that
> encoding of NSMenuItemCell has changed. It seems to me, that mentioned change
> is the reason of this bug. (Files with NSPopUpButton would not load)
Thanks - yes - it is - I didn't realize it.
What about the following patch -
Index: NSMenuItemCell.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSMenuItemCell.m,v
retrieving revision 1.28
diff -u -r1.28 NSMenuItemCell.m
--- NSMenuItemCell.m 23 Feb 2002 11:58:54 -0000 1.28
+++ NSMenuItemCell.m 25 Feb 2002 17:54:00 -0000
@@ -661,9 +661,10 @@
/*
* NSCoding protocol
*
- * Normally unused since the NSMenu encodes/decodes the NSMenuItems, but
- * not the NSMenuItemCells.
- */
+ * Normally unused by the NSMenu since the NSMenu encodes/decodes the
+ * NSMenuItems, but not the NSMenuItemCells. Unfortunately, used by the
+ * NSPopUpButtonCell, which inherits from NSMenuItemCell.
+*/
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[super encodeWithCoder: aCoder];
@@ -676,6 +677,12 @@
[super initWithCoder: aDecoder];
ASSIGN (_menuItem, [aDecoder decodeObject]);
+
+ if ([aDecoder versionForClassName: @"NSMenuItemCell"] < 2)
+ {
+ /* In version 1, we used to encode the _menuView here. */
+ [aDecoder decodeObject];
+ }
_needs_sizing = YES;
Let me know if it works.