[Libreoffice-commits] core.git: vcl/osx
Stephan Bergmann
sbergman at redhat.com
Mon Nov 2 11:09:48 PST 2015
vcl/osx/salframe.cxx | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
New commits:
commit 1ab135c3621e4be9f48754d300e5cd57cb446184
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Nov 2 20:07:14 2015 +0100
Handle case that pDock may have no items
...in code introduced with be1b03a4b0f61b49a3aba8d6b78ae69be7295785 "dock icon's
menu doesn't begin with separator anymore," causing CppunitTest_vcl_lifecycle to
fail
Change-Id: If6eb1f3a0f52d05284ac01f448888aaaa7523a98
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 8634ce9..c4614a8 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -118,8 +118,11 @@ AquaSalFrame::~AquaSalFrame()
NSMenu* pDock = AquaSalInstance::GetDynamicDockMenu();
// life cycle comment: the menu has ownership of the item, so no release
[pDock removeItem: mpDockMenuEntry];
- if ( [[pDock itemAtIndex: 0] isSeparatorItem] )
+ if ([pDock numberOfItems] != 0
+ && [[pDock itemAtIndex: 0] isSeparatorItem])
+ {
[pDock removeItemAtIndex: 0];
+ }
}
if ( mpNSView ) {
[AquaA11yFactory revokeView: mpNSView];
@@ -304,9 +307,11 @@ void AquaSalFrame::SetTitle(const OUString& rTitle)
{
NSMenu* pDock = AquaSalInstance::GetDynamicDockMenu();
- NSMenuItem* pTopItem = [pDock itemAtIndex: 0];
- if ( [pTopItem hasSubmenu] )
- [pDock insertItem: [NSMenuItem separatorItem] atIndex: 0];
+ if ([pDock numberOfItems] != 0) {
+ NSMenuItem* pTopItem = [pDock itemAtIndex: 0];
+ if ( [pTopItem hasSubmenu] )
+ [pDock insertItem: [NSMenuItem separatorItem] atIndex: 0];
+ }
mpDockMenuEntry = [pDock insertItemWithTitle: pTitle
action: @selector(dockMenuItemTriggered:)
More information about the Libreoffice-commits
mailing list