summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2019-09-27 22:02:06 +0100
committerMichael Meeks <michael.meeks@collabora.com>2019-09-28 11:01:18 +0200
commitfc79f23922ccae8b494b31a5dd7bb4767e50c87e (patch)
treeb95476b0716c9c30333cc7febc92f893f21dfaec /vcl
parent40c2e33ce47ff1e51f412e20f306b0849517ebcb (diff)
Hold reference on parent dialog while emitting EndDialog.
Also cleanup the code. Change-Id: I5f9d562319dc244ee22feb2e3fd64023bc229c4e Reviewed-on: https://gerrit.libreoffice.org/79771 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/79777 Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/button.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 0036d6dbb90d..b130686d82ee 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1691,13 +1691,14 @@ void OKButton::Click()
{
if ( pParent->IsDialog() )
{
- if ( static_cast<Dialog*>(pParent)->IsInExecute() )
- static_cast<Dialog*>(pParent)->EndDialog( RET_OK );
+ VclPtr<Dialog> xParent( static_cast<Dialog*>(pParent) );
+ if ( xParent->IsInExecute() )
+ xParent->EndDialog( RET_OK );
// prevent recursive calls
- else if ( !static_cast<Dialog*>(pParent)->IsInClose() )
+ else if ( !xParent->IsInClose() )
{
if ( pParent->GetStyle() & WB_CLOSEABLE )
- static_cast<Dialog*>(pParent)->Close();
+ xParent->Close();
}
}
else