Skip to content

Commit

Permalink
Set pullsDown last to avoid accidentally setting state
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Nov 27, 2024
1 parent bb2eab6 commit 1ad7d18
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Source/NSPopUpButtonCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,6 @@ - (void) setMenuItem: (NSMenuItem *)item
[_menuItem setImage: nil];
}

//[super setMenuItem: item];
ASSIGN(_menuItem, item);

if ([_menuItem image] == nil)
Expand Down Expand Up @@ -1321,7 +1320,7 @@ - (id) initWithCoder: (NSCoder*)aDecoder
}
else
{
NSInteger flag;
NSInteger flag, pullsDown;
id<NSMenuItem> selectedItem;
int version = [aDecoder versionForClassName:
@"NSPopUpButtonCell"];
Expand All @@ -1336,8 +1335,7 @@ - (id) initWithCoder: (NSCoder*)aDecoder
[self setMenu: nil];
[self setMenu: menu];
selectedItem = [aDecoder decodeObject];
decode_NSInteger(aDecoder, &flag);
[self setPullsDown: flag];
decode_NSInteger(aDecoder, &pullsDown);
decode_NSInteger(aDecoder, &flag);
[self setPreferredEdge: flag];
decode_NSInteger(aDecoder, &flag);
Expand All @@ -1347,6 +1345,7 @@ - (id) initWithCoder: (NSCoder*)aDecoder
decode_NSInteger(aDecoder, &flag);
[self setArrowPosition: flag];
[self setMenuItem: (NSMenuItem *)selectedItem];
[self setPullsDown: pullsDown];

if (version < 2)
{
Expand Down

0 comments on commit 1ad7d18

Please sign in to comment.