summaryrefslogtreecommitdiff
path: root/sw/source/uibase/uiview
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-06-20 15:56:35 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-23 06:28:00 +0000
commitaa0d0536a444fb26d9e570bd6bf6c1bdc3596cf3 (patch)
tree8b2a5207e77fa4054a37b33c25378c23a00af8ed /sw/source/uibase/uiview
parentb722f3d6fc72877e8caaaae7291d5d736ddc494d (diff)
tdf#97527 - vcl: reference-count Menu
some places are marked with "dodgy"- need to check those to see what is going on, because they are leaving dangling pointers behind in the Menu class Change-Id: I41d5c7c0fec2f70ce9e3ffdc48cd03d26c0a869b Reviewed-on: https://gerrit.libreoffice.org/26516 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw/source/uibase/uiview')
-rw-r--r--sw/source/uibase/uiview/viewling.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index 905ceca86120..094377cc3ff8 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -703,22 +703,22 @@ bool SwView::ExecSpellPopup(const Point& rPt)
bRet = true;
m_pWrtShell->SttSelect();
- std::unique_ptr< SwSpellPopup > pPopup;
+ ScopedVclPtr< SwSpellPopup > pPopup;
if (bUseGrammarContext)
{
sal_Int32 nPos = aPoint.nContent.GetIndex();
(void) nPos;
- pPopup.reset(new SwSpellPopup( m_pWrtShell, aGrammarCheckRes, nErrorInResult, aSuggestions, aParaText ));
+ pPopup = VclPtr<SwSpellPopup>::Create( m_pWrtShell, aGrammarCheckRes, nErrorInResult, aSuggestions, aParaText ).get();
}
else
- pPopup.reset(new SwSpellPopup( m_pWrtShell, xAlt, aParaText ));
+ pPopup = VclPtr<SwSpellPopup>::Create( m_pWrtShell, xAlt, aParaText ).get();
ui::ContextMenuExecuteEvent aEvent;
const Point aPixPos = GetEditWin().LogicToPixel( rPt );
aEvent.SourceWindow = VCLUnoHelper::GetInterface( m_pEditWin );
aEvent.ExecutePosition.X = aPixPos.X();
aEvent.ExecutePosition.Y = aPixPos.Y();
- Menu* pMenu = nullptr;
+ VclPtr<Menu> pMenu;
OUString sMenuName = bUseGrammarContext ?
OUString("private:resource/GrammarContextMenu") : OUString("private:resource/SpellContextMenu");
@@ -729,8 +729,8 @@ bool SwView::ExecSpellPopup(const Point& rPt)
//! 'custom made' menu... *sigh* (code copied from sfx2 and framework)
if ( pMenu )
{
- const sal_uInt16 nId = static_cast<PopupMenu*>(pMenu)->Execute(m_pEditWin, aPixPos);
- OUString aCommand = static_cast<PopupMenu*>(pMenu)->GetItemCommand(nId);
+ const sal_uInt16 nId = static_cast<PopupMenu*>(pMenu.get())->Execute(m_pEditWin, aPixPos);
+ OUString aCommand = static_cast<PopupMenu*>(pMenu.get())->GetItemCommand(nId);
if (aCommand.isEmpty() )
{
if(!ExecuteMenuCommand(dynamic_cast<PopupMenu&>(*pMenu), *GetViewFrame(), nId ))