From e931b059571c9f0cad4cc5ec6bd75a3ab46fb0d1 Mon Sep 17 00:00:00 2001 From: Katarina Behrens Date: Mon, 24 Aug 2015 13:00:08 +0200 Subject: tdf#93437: release reference held by ScFormulaReferenceHelper This does two things: reverts a revert of 087f7fe50b03307e2d9202365886e8c37bd7e6e3 -- turns out it was innocent. Plus, it actually releases the reference that prevents destructor from being called. It was actually ScFormulaDlg's own m_aHelper member variable holding reference to 'this' (extra-wicked, through SetWindow(this)), never releasing it. Change-Id: I258a280e09674d1a2f1ddebea19ea1b42dcdc777 Reviewed-on: https://gerrit.libreoffice.org/17949 Reviewed-by: Eike Rathke Tested-by: Eike Rathke --- sc/source/ui/formdlg/formula.cxx | 1 + sc/source/ui/inc/tabvwsh.hxx | 6 +++--- sc/source/ui/view/reffact.cxx | 2 +- sc/source/ui/view/tabvwshc.cxx | 11 ++++++----- 4 files changed, 11 insertions(+), 9 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index d6c1b1734220..ba871d415bb3 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -248,6 +248,7 @@ void ScFormulaDlg::dispose() { ScModule* pScMod = SC_MOD(); ScFormEditData* pData = pScMod->GetFormEditData(); + m_aHelper.dispose(); if (pData) // close dosen't destroy; { diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 9820553a36e8..df4ba4837d4b 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -341,9 +341,9 @@ public: void DeactivateOle(); SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell(); - SfxModelessDialog* CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW, - SfxChildWinInfo* pInfo, - vcl::Window* pParent, sal_uInt16 nSlotId ); + VclPtr CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW, + SfxChildWinInfo* pInfo, + vcl::Window* pParent, sal_uInt16 nSlotId ); void UpdateOleZoom(); diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx index 660a8778176c..75c69b1aea16 100644 --- a/sc/source/ui/view/reffact.cxx +++ b/sc/source/ui/view/reffact.cxx @@ -91,7 +91,7 @@ namespace pViewShell = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); \ OSL_ENSURE( pViewShell, "missing view shell :-(" ); \ pWindow = pViewShell ? \ - pViewShell->CreateRefDialog( p, this, pInfo, pParentP, sid ) : NULL; \ + pViewShell->CreateRefDialog( p, this, pInfo, pParentP, sid ) : nullptr; \ if (pViewShell && !pWindow) \ pViewShell->GetViewFrame()->SetChildWindow( nId, false ); \ } diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 8a85b2230ce1..38502d2856a7 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -113,9 +113,10 @@ void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialog* pDialog) } } -SfxModelessDialog* ScTabViewShell::CreateRefDialog( - SfxBindings* pB, SfxChildWindow* pCW, SfxChildWinInfo* pInfo, - vcl::Window* pParent, sal_uInt16 nSlotId ) +VclPtr ScTabViewShell::CreateRefDialog( + SfxBindings* pB, SfxChildWindow* pCW, + SfxChildWinInfo* pInfo, + vcl::Window* pParent, sal_uInt16 nSlotId ) { // Dialog nur aufmachen, wenn ueber ScModule::SetRefDialog gerufen, damit // z.B. nach einem Absturz offene Ref-Dialoge nicht wiederkommen (#42341#). @@ -132,7 +133,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( return NULL; } - SfxModelessDialog* pResult = 0; + VclPtr pResult; if(pCW) pCW->SetHideNotDelete(true); @@ -156,7 +157,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( ScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetTabNo() ), &maRangeMap); - static_cast(pResult)->SetEntry( maName, maScope); + static_cast(pResult.get())->SetEntry( maName, maScope); mbInSwitch = false; } } -- cgit