diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-02-02 16:18:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-02-02 16:26:18 +0000 |
commit | d92d7e4919311a1cf18b34dbb3d03bbc4f962f43 (patch) | |
tree | 7d539858e8e69348a127dc8e96c142f8a442d1ff /vcl | |
parent | d9da9b441185a730f2677da6aa6393468b4cf3ff (diff) |
crash on toggling "empty" menu in basic's language toolbar
tools->macros->organize->basic->edit
drag language toolbar to undock, click down arrow in pseudo-title bar to get
"no selection possible" entry. click down arrow again to dismiss it.
get debug stl iterator error
the mpSalMenu goes out of sync with its owner
Change-Id: If82aac004e623787389dd415c2006b99778f710d
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/menu.cxx | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 30b8cdc96806..078e1bb31ec9 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -366,6 +366,21 @@ void Menu::RemoveEventListener( const Link& rEventListener ) maEventListeners.removeListener( rEventListener ); } +MenuItemData* Menu::NbcInsertItem(sal_uInt16 nId, MenuItemBits nBits, + const OUString& rStr, Menu* pMenu, + size_t nPos, const OString &rIdent) +{ + // put Item in MenuItemList + MenuItemData* pData = pItemList->Insert(nId, MenuItemType::STRING, + nBits, rStr, Image(), pMenu, nPos, rIdent); + + // update native menu + if (ImplGetSalMenu() && pData->pSalMenuItem) + ImplGetSalMenu()->InsertItem(pData->pSalMenuItem, nPos); + + return pData; +} + void Menu::InsertItem(sal_uInt16 nItemId, const OUString& rStr, MenuItemBits nItemBits, const OString &rIdent, sal_uInt16 nPos) { @@ -378,12 +393,7 @@ void Menu::InsertItem(sal_uInt16 nItemId, const OUString& rStr, MenuItemBits nIt nPos = MENU_APPEND; // put Item in MenuItemList - MenuItemData* pData = pItemList->Insert(nItemId, MenuItemType::STRING, - nItemBits, rStr, Image(), this, nPos, rIdent); - - // update native menu - if( ImplGetSalMenu() && pData->pSalMenuItem ) - ImplGetSalMenu()->InsertItem( pData->pSalMenuItem, nPos ); + NbcInsertItem(nItemId, nItemBits, rStr, this, nPos, rIdent); vcl::Window* pWin = ImplGetWindow(); delete mpLayoutData, mpLayoutData = NULL; @@ -2877,8 +2887,8 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_ if( pResMgr ) { OUString aTmpEntryText( ResId( SV_RESID_STRING_NOSELECTIONPOSSIBLE, *pResMgr ) ); - MenuItemData* pData = pItemList->Insert( - 0xFFFF, MenuItemType::STRING, MenuItemBits::NONE, aTmpEntryText, Image(), NULL, 0xFFFF, OString() ); + + MenuItemData* pData = NbcInsertItem(0xFFFF, MenuItemBits::NONE, aTmpEntryText, NULL, 0xFFFF, OString()); size_t nPos = 0; pData = pItemList->GetData( pData->nId, nPos ); assert(pData); |