[Libreoffice-commits] .: 2 commits - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Aug 25 09:38:53 PDT 2012


 sw/source/ui/config/optload.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 5bf93a18e645f5e7146402d5dfa6958ddee44de7
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Sat Aug 25 20:33:36 2012 +0400

    use dynamic_cast, prevent crash when opening Options-Writer-AutoCaption
    
    SwCaptionOptPage can be added either to SwCaptionOptDlg or OfaTreeOptionsDialog
    
    Change-Id: I0cedfc27f8d1f1bbf5e19dce2f438fc782cd5832

diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 19be1a2..e2d519a 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -770,8 +770,8 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ModifyHdl)
 {
     String sFldTypeName = aCategoryBox.GetText();
 
-    SfxSingleTabDialog *pDlg = (SfxSingleTabDialog *)GetParent();
-    PushButton *pBtn = pDlg->GetOKButton();
+    SfxSingleTabDialog *pDlg = dynamic_cast<SfxSingleTabDialog*>(GetParent());
+    PushButton *pBtn = pDlg ? pDlg->GetOKButton() : NULL;
     if (pBtn)
         pBtn->Enable(sFldTypeName.Len() != 0);
     sal_Bool bEnable = aCategoryBox.IsEnabled() && sFldTypeName != sNone;
commit 55b79fa2f104e08b940b7019c52dffbafaa13f61
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Sat Aug 25 20:24:57 2012 +0400

    Revert "cast to wrong type, can cause crash when opening Options-Writer-AutoCa
    
    Wrong fix: GetParent can return pointer to SwCaptionOptDlg which is
    derived from SfxSingleTabDialog.
    This reverts commit a5546942ec70fca551401ae61eee00b66a92f81d.

diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 65752e3..19be1a2 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -769,6 +769,11 @@ void SwCaptionOptPage::SaveEntry(SvLBoxEntry* pEntry)
 IMPL_LINK_NOARG(SwCaptionOptPage, ModifyHdl)
 {
     String sFldTypeName = aCategoryBox.GetText();
+
+    SfxSingleTabDialog *pDlg = (SfxSingleTabDialog *)GetParent();
+    PushButton *pBtn = pDlg->GetOKButton();
+    if (pBtn)
+        pBtn->Enable(sFldTypeName.Len() != 0);
     sal_Bool bEnable = aCategoryBox.IsEnabled() && sFldTypeName != sNone;
 
     aFormatText.Enable(bEnable);


More information about the Libreoffice-commits mailing list