summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-05-08 11:33:33 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-05-08 12:24:05 +0100
commit087f7fe50b03307e2d9202365886e8c37bd7e6e3 (patch)
tree759c053074ac07f08c993203bf08e9011483082f
parentece4466e4ff5f89aad0ec88b39269cfac0dc76c3 (diff)
tdf#91125 - nail a clutch of calc modeless dialog lifecycle issues.
Good idea to hold a reference after creation. Change-Id: I450c415259c4011c8b3fb8be715e55643765d9db
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx6
-rw-r--r--sc/source/ui/view/reffact.cxx2
-rw-r--r--sc/source/ui/view/tabvwshc.cxx11
3 files changed, 10 insertions, 9 deletions
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 4bc50e5ed59a..04e21a965ada 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -356,9 +356,9 @@ public:
void DeactivateOle();
SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell();
- SfxModelessDialog* CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW,
- SfxChildWinInfo* pInfo,
- vcl::Window* pParent, sal_uInt16 nSlotId );
+ VclPtr<SfxModelessDialog> CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW,
+ SfxChildWinInfo* pInfo,
+ vcl::Window* pParent, sal_uInt16 nSlotId );
void UpdateOleZoom();
inline SbxObject* GetScSbxObject() const
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index 4ba4eb96acac..b05db95f2c0d 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -90,7 +90,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 fbbfa248d74e..4d5d2d4a66d8 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<SfxModelessDialog> 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<SfxModelessDialog> pResult;
if(pCW)
pCW->SetHideNotDelete(true);
@@ -156,7 +157,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
ScAddress( GetViewData().GetCurX(),
GetViewData().GetCurY(),
GetViewData().GetTabNo() ), &maRangeMap);
- static_cast<ScNameDlg*>(pResult)->SetEntry( maName, maScope);
+ static_cast<ScNameDlg*>(pResult.get())->SetEntry( maName, maScope);
mbInSwitch = false;
}
}