From efb02fcddb7abe7f6f163ee8a47878b06d15a610 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Mon, 21 Jul 2014 13:14:19 +0100
Subject: [PATCH] Resolves: rhbz#1121341 crash on closing shrunk validity
window
Change-Id: I5fc1d6b909b3281ec3799b60bc3fd7b5f1163a75
---
sc/source/ui/dbgui/validate.cxx | 29 ++++++++++++++++++++++++-----
sc/source/ui/inc/validate.hxx | 2 ++
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index f40981c..d119747 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -151,12 +151,14 @@ void ScTPValidationValue::RefInputDonePostHdl()
}
-
sal_Bool ScValidationDlg::Close()
{
- if( m_bOwnRefHdlr )
- if( SfxTabPage* pPage = GetTabPage( TP_VALIDATION_VALUES ) )
- static_cast<ScTPValidationValue*>(pPage)->RemoveRefDlg();
+ SfxTabPage* pPage = GetTabPage(TP_VALIDATION_VALUES);
+ if (pPage)
+ static_cast<ScTPValidationValue*>(pPage)->ParkRefs();
+
+ if (m_bOwnRefHdlr && pPage)
+ static_cast<ScTPValidationValue*>(pPage)->RemoveRefDlg();
return ScValidationDlgBase::Close();
}
@@ -168,7 +170,6 @@ ScValidationDlg::~ScValidationDlg()
delete mpHBox;
}
-
// ============================================================================
namespace {
@@ -338,6 +339,22 @@ ScTPValidationValue::ScTPValidationValue( Window* pParent, const SfxItemSet& rAr
m_btnRef.Hide(); // cell range picker
}
+void ScTPValidationValue::ParkRefs()
+{
+ //if there are children of the mpHBox, i.e.
+ //in shrunk mode, this will crash
+ //after the mpHBox is deleted
+ if( m_pRefEdit && m_pRefEdit->GetParent()!= this )
+ {
+ m_pRefEdit->SetParent( this );
+ }
+
+ if( m_btnRef.GetParent()!=this )
+ {
+ m_btnRef.SetParent( this );
+ }
+}
+
ScTPValidationValue::~ScTPValidationValue()
{
}
diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx
index 5cac401..12d1cec 100644
--- a/sc/source/ui/inc/validate.hxx
+++ b/sc/source/ui/inc/validate.hxx
@@ -182,6 +182,8 @@ public:
virtual sal_Bool FillItemSet( SfxItemSet& rArgSet );
virtual void Reset( const SfxItemSet& rArgSet );
+ void ParkRefs();
+
private:
void Init();
--
1.9.3