mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-03 17:30:42 +00:00
* Source/NSMenuView.m (-heightForItem:): Use
-menuItemCellForItemAtIndex: to protect against an index being to big. This happens when the menu does not send notifications and a non-existing item gets highlighted. * Source/NSMenuView.m (-menuItemCellForItemAtIndex:): Protect against negative index values. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37279 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
58829e5f8d
commit
c2f1410076
2 changed files with 16 additions and 5 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2013-10-26 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSMenuView.m (-heightForItem:): Use
|
||||||
|
-menuItemCellForItemAtIndex: to protect against an index being to
|
||||||
|
big. This happens when the menu does not send notifications and a
|
||||||
|
non-existing item gets highlighted.
|
||||||
|
* Source/NSMenuView.m (-menuItemCellForItemAtIndex:): Protect
|
||||||
|
against negative index values.
|
||||||
|
|
||||||
2013-10-20 Fred Kiefer <FredKiefer@gmx.de>
|
2013-10-20 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSBitmapImageRep+PNG.m: Better cleanup on error.
|
* Source/NSBitmapImageRep+PNG.m: Better cleanup on error.
|
||||||
|
|
|
@ -444,7 +444,7 @@ static float menuBarHeight = 0.0;
|
||||||
|
|
||||||
- (NSMenuItemCell*) menuItemCellForItemAtIndex: (NSInteger)index
|
- (NSMenuItemCell*) menuItemCellForItemAtIndex: (NSInteger)index
|
||||||
{
|
{
|
||||||
if (index < [_itemCells count])
|
if ((index >= 0) && (index < [_itemCells count]))
|
||||||
return [_itemCells objectAtIndex: index];
|
return [_itemCells objectAtIndex: index];
|
||||||
else
|
else
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -703,9 +703,10 @@ static float menuBarHeight = 0.0;
|
||||||
|
|
||||||
- (CGFloat) heightForItem: (NSInteger)idx
|
- (CGFloat) heightForItem: (NSInteger)idx
|
||||||
{
|
{
|
||||||
if (idx >= 0)
|
NSMenuItemCell *cell = [self menuItemCellForItemAtIndex: idx];
|
||||||
|
|
||||||
|
if (cell != nil)
|
||||||
{
|
{
|
||||||
NSMenuItemCell *cell = [_itemCells objectAtIndex: idx];
|
|
||||||
NSMenuItem *item = [cell menuItem];
|
NSMenuItem *item = [cell menuItem];
|
||||||
|
|
||||||
if ([item isSeparatorItem])
|
if ([item isSeparatorItem])
|
||||||
|
@ -736,6 +737,7 @@ static float menuBarHeight = 0.0;
|
||||||
{
|
{
|
||||||
CGFloat total = 0;
|
CGFloat total = 0;
|
||||||
NSUInteger i = 0;
|
NSUInteger i = 0;
|
||||||
|
|
||||||
for (i = 0; i < [_itemCells count]; i++)
|
for (i = 0; i < [_itemCells count]; i++)
|
||||||
{
|
{
|
||||||
total += [self heightForItem: i];
|
total += [self heightForItem: i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue