[Libreoffice-commits] core.git: 8 commits - desktop/source framework/source include/svtools reportdesign/source sal/cppunittester sfx2/source svtools/source sw/source

Caolán McNamara caolanm at redhat.com
Sat May 9 09:19:09 PDT 2015


 desktop/source/lib/init.cxx                  |    5 
 framework/source/helper/statusindicator.cxx  |    4 
 include/svtools/filectrl.hxx                 |    2 
 reportdesign/source/ui/dlg/GroupsSorting.cxx |    2 
 reportdesign/source/ui/inc/GroupsSorting.hxx |    2 
 sal/cppunittester/cppunittester.cxx          |  139 ++++++++++++++-------------
 sfx2/source/dialog/dockwin.cxx               |    4 
 svtools/source/control/filectrl.cxx          |    9 +
 svtools/source/uno/unoiface.cxx              |    4 
 sw/source/core/draw/dflyobj.cxx              |   10 +
 sw/source/core/frmedt/fetab.cxx              |   23 +++-
 sw/source/core/layout/findfrm.cxx            |   20 +--
 sw/source/core/layout/wsfrm.cxx              |    8 -
 13 files changed, 132 insertions(+), 100 deletions(-)

New commits:
commit 4d2d58bdb32dd94a23ea721e2334a8b1cf459b08
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 9 16:51:13 2015 +0100

    bodge layout to not crash on load of File_1292.docx
    
    Change-Id: I3eba9c8b3883ca4fca38e27d351508c9e01d9c08

diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index d78f1b7..cc5a81e 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1092,9 +1092,9 @@ bool SwFEShell::CheckHeadline( bool bRepeat ) const
     if ( !IsTableMode() )
     {
         SwFrm *pFrm = GetCurrFrm();  // DONE MULTIIHEADER
-        if ( pFrm && pFrm->IsInTab() )
+        SwTabFrm* pTab = (pFrm && pFrm->IsInTab()) ? pFrm->FindTabFrm() : NULL;
+        if (pTab)
         {
-            SwTabFrm* pTab = pFrm->FindTabFrm();
             if ( bRepeat )
             {
                 bRet = pTab->IsFollow() && pTab->IsInHeadline( *pFrm );
@@ -1140,8 +1140,14 @@ bool SwFEShell::IsAdjustCellWidthAllowed( bool bBalance ) const
     if ( aBoxes.empty() )
     {
         do
-        {   pFrm = pFrm->GetUpper();
-        } while ( !pFrm->IsCellFrm() );
+        {
+            pFrm = pFrm->GetUpper();
+        }
+        while (pFrm && !pFrm->IsCellFrm());
+
+        if (!pFrm)
+            return false;
+
         SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<const SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox()));
         aBoxes.insert( pBox );
     }
@@ -1385,6 +1391,9 @@ static const SwCellFrm *lcl_FindFrm( const SwLayoutFrm *pLay, const Point &rPt,
             if ( pFrm->IsInTab() )
                 pFrm = const_cast<SwFrm*>(pFrm)->ImplFindTabFrm();
 
+            if (!pFrm)
+                break;
+
             if ( pFrm->IsTabFrm() )
             {
                 Point aPt( rPt );
@@ -2341,10 +2350,10 @@ bool SwFEShell::IsMouseTableRightToLeft(const Point &rPt) const
 bool SwFEShell::IsTableVertical() const
 {
     SwFrm *pFrm = GetCurrFrm();
-    if( !pFrm || !pFrm->IsInTab() )
+    SwTabFrm *pTab = (pFrm && pFrm->IsInTab()) ? pFrm->ImplFindTabFrm() : NULL;
+    if (!pTab)
         return false;
-
-    return pFrm->ImplFindTabFrm()->IsVertical();
+    return pTab->IsVertical();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index f1aa832..b69a258 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -710,16 +710,16 @@ SwFrm *SwFrm::_FindNext()
     if ( !bIgnoreTab && pThis->IsInTab() )
     {
         SwLayoutFrm *pUp = pThis->GetUpper();
-        while ( !pUp->IsCellFrm() )
+        while (pUp && !pUp->IsCellFrm())
             pUp = pUp->GetUpper();
-        OSL_ENSURE( pUp, "Cntnt in Tabelle aber nicht in Zelle." );
-        SwFrm* pNxt = static_cast<SwCellFrm*>(pUp)->GetFollowCell();
+        SAL_WARN_IF(!pUp, "sw.core", "Cntnt in table but not in cell.");
+        SwFrm* pNxt = pUp ? static_cast<SwCellFrm*>(pUp)->GetFollowCell() : NULL;
         if ( pNxt )
             pNxt = static_cast<SwCellFrm*>(pNxt)->ContainsCntnt();
         if ( !pNxt )
         {
             pNxt = lcl_NextFrm( pThis );
-            if ( pUp->IsAnLower( pNxt ) )
+            if (pUp && pUp->IsAnLower(pNxt))
                 pRet = pNxt;
         }
         else
@@ -1069,10 +1069,10 @@ SwFrm *SwFrm::_FindPrev()
         if ( !bIgnoreTab && pThis->IsInTab() )
         {
             SwLayoutFrm *pUp = pThis->GetUpper();
-            while ( !pUp->IsCellFrm() )
+            while (pUp && !pUp->IsCellFrm())
                 pUp = pUp->GetUpper();
-            OSL_ENSURE( pUp, "Cntnt in table but not in cell." );
-            if ( pUp->IsAnLower( pPrvCnt ) )
+            SAL_WARN_IF(!pUp, "sw.core", "Cntnt in table but not in cell.");
+            if (pUp && pUp->IsAnLower(pPrvCnt))
                 return pPrvCnt;
         }
         else
@@ -1391,11 +1391,11 @@ void SwFrm::SetDirFlags( bool bVert )
 SwLayoutFrm* SwFrm::GetNextCellLeaf( MakePageType )
 {
     SwFrm* pTmpFrm = this;
-    while ( !pTmpFrm->IsCellFrm() )
+    while (pTmpFrm && !pTmpFrm->IsCellFrm())
         pTmpFrm = pTmpFrm->GetUpper();
 
-    OSL_ENSURE( pTmpFrm, "SwFrm::GetNextCellLeaf() without cell" );
-    return static_cast<SwCellFrm*>(pTmpFrm)->GetFollowCell();
+    SAL_WARN_IF(!pTmpFrm, "sw.core", "SwFrm::GetNextCellLeaf() without cell");
+    return pTmpFrm ? static_cast<SwCellFrm*>(pTmpFrm)->GetFollowCell() : NULL;
 }
 
 SwLayoutFrm* SwFrm::GetPrevCellLeaf( MakePageType )
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index caf63ca..505e225 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -1753,9 +1753,9 @@ SwTwips SwCntntFrm::GrowFrm( SwTwips nDist, bool bTst, bool bInfo )
         (Frm().*fnRect->fnSetHeight)( nOld + nDist );
         if( IsVertical()&& !IsVertLR() && !IsReverse() )
             Frm().Pos().X() -= nDist;
-        if ( nOld && IsInTab() )
+        SwTabFrm *pTab = (nOld && IsInTab()) ? FindTabFrm() : NULL;
+        if (pTab)
         {
-            SwTabFrm *pTab = FindTabFrm();
             if ( pTab->GetTable()->GetHTMLTableLayout() &&
                  !pTab->IsJoinLocked() &&
                  !pTab->GetFmt()->GetDoc()->GetDocShell()->IsReadOnly() )
@@ -1841,9 +1841,9 @@ SwTwips SwCntntFrm::ShrinkFrm( SwTwips nDist, bool bTst, bool bInfo )
         if( IsVertical() && !IsVertLR() )
             Frm().Pos().X() += nDist;
         nDist = nRstHeight;
-        if ( IsInTab() )
+        SwTabFrm *pTab = IsInTab() ? FindTabFrm() : NULL;
+        if (pTab)
         {
-            SwTabFrm *pTab = FindTabFrm();
             if ( pTab->GetTable()->GetHTMLTableLayout() &&
                  !pTab->IsJoinLocked() &&
                  !pTab->GetFmt()->GetDoc()->GetDocShell()->IsReadOnly() )
commit a2447aa82b0d33d3e703b6d2e62aa892541db8d4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 9 15:00:43 2015 +0100

    coverity#1257113 Uninitialized pointer field
    
    Change-Id: If1454e643bba38a0bffd0e14a28045dc5e544d11

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4cdce60..00d0976 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -291,8 +291,9 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit
     void *mpCallbackData;
 
     LibLibreOffice_Impl()
-        : maThread(0),
-          mpCallback(nullptr)
+        : maThread(0)
+        , mpCallback(nullptr)
+        , mpCallbackData(nullptr)
     {
         if(!(m_pOfficeClass = gOfficeClass.lock())) {
             m_pOfficeClass.reset(new LibreOfficeKitClass);
commit a5847cffcec79465bb281851aeaf34a4ca7c825b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 9 14:58:56 2015 +0100

    coverity#1297235 Uncaught exception
    
    Change-Id: I6b135f6d47352c1fbb729788848913402b7bb742

diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index 6c15417..b637fb6 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -294,85 +294,94 @@ public:
 
 }
 
-SAL_IMPLEMENT_MAIN() {
+SAL_IMPLEMENT_MAIN()
+{
+    bool ok = false;
+    try
+    {
 #ifdef WNT
-    //Disable Dr-Watson in order to crash simply without popup dialogs under
-    //windows
-    DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
-    SetErrorMode(SEM_NOGPFAULTERRORBOX|dwMode);
+        //Disable Dr-Watson in order to crash simply without popup dialogs under
+        //windows
+        DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
+        SetErrorMode(SEM_NOGPFAULTERRORBOX|dwMode);
 #ifdef _DEBUG // These functions are present only in the debgging runtime
-    _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
-    _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
-    _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
-    _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
-    _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
-    _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+        _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
+        _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+        _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
+        _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+        _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE);
+        _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
 #endif
 #endif
 
-    std::vector<CppUnit::Protector *> protectors;
-    CppUnit::TestResult result;
-    std::string args;
-    std::string testlib;
-    sal_uInt32 index = 0;
-    while (index < rtl_getAppCommandArgCount())
-    {
-        rtl::OUString arg = getArgument(index);
-        if ( arg != "--protector" )
+        std::vector<CppUnit::Protector *> protectors;
+        CppUnit::TestResult result;
+        std::string args;
+        std::string testlib;
+        sal_uInt32 index = 0;
+        while (index < rtl_getAppCommandArgCount())
         {
-            if (testlib.empty())
+            rtl::OUString arg = getArgument(index);
+            if ( arg != "--protector" )
             {
-                testlib = rtl::OUStringToOString(arg, osl_getThreadTextEncoding()).getStr();
-                args += testlib;
+                if (testlib.empty())
+                {
+                    testlib = rtl::OUStringToOString(arg, osl_getThreadTextEncoding()).getStr();
+                    args += testlib;
+                }
+                else
+                {
+                    args += ' ';
+                    args += rtl::OUStringToOString(arg, osl_getThreadTextEncoding()).getStr();
+                }
+                ++index;
+                continue;
             }
-            else
-            {
-                args += ' ';
-                args += rtl::OUStringToOString(arg, osl_getThreadTextEncoding()).getStr();
+            if (rtl_getAppCommandArgCount() - index < 3) {
+                usageFailure();
             }
-            ++index;
-            continue;
-        }
-        if (rtl_getAppCommandArgCount() - index < 3) {
-            usageFailure();
-        }
-        rtl::OUString lib(getArgument(index + 1));
-        rtl::OUString sym(getArgument(index + 2));
+            rtl::OUString lib(getArgument(index + 1));
+            rtl::OUString sym(getArgument(index + 2));
 #ifndef DISABLE_DYNLOADING
-        osl::Module mod(lib, SAL_LOADMODULE_GLOBAL);
-        oslGenericFunction fn = mod.getFunctionSymbol(sym);
-        mod.release();
+            osl::Module mod(lib, SAL_LOADMODULE_GLOBAL);
+            oslGenericFunction fn = mod.getFunctionSymbol(sym);
+            mod.release();
 #else
-        oslGenericFunction fn = 0;
-        if (sym == "unoexceptionprotector")
-            fn = (oslGenericFunction) unoexceptionprotector;
-        else if (sym == "unobootstrapprotector")
-            fn = (oslGenericFunction) unobootstrapprotector;
-        else if (sym == "vclbootstrapprotector")
-            fn = (oslGenericFunction) vclbootstrapprotector;
-        else
-        {
-            std::cerr
-                << "Only unoexceptionprotector or unobootstrapprotector protectors allowed"
-                << std::endl;
-            std::exit(EXIT_FAILURE);
-        }
+            oslGenericFunction fn = 0;
+            if (sym == "unoexceptionprotector")
+                fn = (oslGenericFunction) unoexceptionprotector;
+            else if (sym == "unobootstrapprotector")
+                fn = (oslGenericFunction) unobootstrapprotector;
+            else if (sym == "vclbootstrapprotector")
+                fn = (oslGenericFunction) vclbootstrapprotector;
+            else
+            {
+                std::cerr
+                    << "Only unoexceptionprotector or unobootstrapprotector protectors allowed"
+                    << std::endl;
+                std::exit(EXIT_FAILURE);
+            }
 #endif
-        CppUnit::Protector *protector = fn == 0
-            ? 0
-            : (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))();
-        if (protector == 0) {
-            std::cerr
-                << "Failure instantiating protector \"" << convertLazy(lib)
-                << "\", \"" << convertLazy(sym) << '"' << std::endl;
-            std::exit(EXIT_FAILURE);
+            CppUnit::Protector *protector = fn == 0
+                ? 0
+                : (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))();
+            if (protector == 0) {
+                std::cerr
+                    << "Failure instantiating protector \"" << convertLazy(lib)
+                    << "\", \"" << convertLazy(sym) << '"' << std::endl;
+                std::exit(EXIT_FAILURE);
+            }
+            protectors.push_back(protector);
+            index+=3;
         }
-        protectors.push_back(protector);
-        index+=3;
-    }
 
-    ProtectedFixtureFunctor tests(testlib, args, protectors, result);
-    bool ok = tests.run();
+        ProtectedFixtureFunctor tests(testlib, args, protectors, result);
+        ok = tests.run();
+    }
+    catch (const std::exception& e)
+    {
+        SAL_WARN("vcl.app", "Fatal exception: " << e.what());
+    }
 
     return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
commit a1a3e047aba719802571e8243f931b8de2d6a986
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 9 14:50:45 2015 +0100

    coverity#1297233 Dereference after null check
    
    Change-Id: Id30e16f6f94668b578fe79eab9d8289c8914a32b

diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 8b4b8f3..1b47bbe 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -1239,10 +1239,10 @@ void SfxDockingWindow::FillInfo(SfxChildWinInfo& rInfo) const
 */
 
 {
-    if ( !pMgr )
+    if (!pMgr || !pImp)
         return;
 
-    if ( GetFloatingWindow() && pImp && pImp->bConstructed )
+    if (GetFloatingWindow() && pImp->bConstructed)
         pImp->aWinState = GetFloatingWindow()->GetWindowState();
 
     rInfo.aWinState = pImp->aWinState;
commit bbf2457a0175dc53cc11be34aa94b8c3608332d1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 9 14:48:03 2015 +0100

    coverity#1297232 Division or modulo by float zero
    
    and
    
    coverity#1297231 Division or modulo by float zero
    
    Change-Id: Icb303956bb3804bca1078c1135aca0eff370902b

diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index 4baf26c..56f39c5 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -744,6 +744,12 @@ void SwVirtFlyDrawObj::NbcCrop(const Point& rRef, const Fraction& xFact, const F
     // the object to crop
     Rectangle aOldRect( aOutRect );
 
+    const long nOldWidth = aOldRect.GetWidth();
+    const long nOldHeight = aOldRect.GetHeight();
+
+    if (!nOldWidth || !nOldHeight)
+        return;
+
     Rectangle aNewRect( aOutRect );
     ResizeRect( aNewRect, rRef, xFact, yFact );
 
@@ -772,8 +778,8 @@ void SwVirtFlyDrawObj::NbcCrop(const Point& rRef, const Fraction& xFact, const F
         convertTwipToMm100(aCrop.GetBottom()) );
 
     // Compute delta to apply
-    double fScaleX = ( aGraphicSize.Width() - aCropRectangle.Left() - aCropRectangle.Right() ) / (double)aOldRect.GetWidth();
-    double fScaleY = ( aGraphicSize.Height() - aCropRectangle.Top() - aCropRectangle.Bottom() ) / (double)aOldRect.GetHeight();
+    double fScaleX = ( aGraphicSize.Width() - aCropRectangle.Left() - aCropRectangle.Right() ) / (double)nOldWidth;
+    double fScaleY = ( aGraphicSize.Height() - aCropRectangle.Top() - aCropRectangle.Bottom() ) / (double)nOldHeight;
 
     sal_Int32 nDiffLeft = aNewRect.Left() - aOldRect.Left();
     sal_Int32 nDiffTop = aNewRect.Top() - aOldRect.Top();
commit b307609b18b6a945710e85f84d69763cfd1d95d1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 9 14:39:10 2015 +0100

    coverity#1297234 Uncaught exception
    
    Change-Id: I6ce09d3a7c77c5501608a2d1b0812c3c22ef16af

diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index 0623eb2..3bea4c0 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -1233,7 +1233,7 @@ void OGroupsSortingDialog::showHelpText(sal_uInt16 _nResId)
     m_pHelpWindow->SetText(OUString(ModuleRes(_nResId)));
 }
 
-void OGroupsSortingDialog::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw( uno::RuntimeException)
+void OGroupsSortingDialog::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) throw(uno::RuntimeException, std::exception)
 {
     uno::Reference< report::XGroup > xGroup(_rEvent.Source,uno::UNO_QUERY);
     if ( xGroup.is() )
diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx
index b9c1947..e1a7fb3 100644
--- a/reportdesign/source/ui/inc/GroupsSorting.hxx
+++ b/reportdesign/source/ui/inc/GroupsSorting.hxx
@@ -139,7 +139,7 @@ private:
     void operator =(OGroupsSortingDialog&) SAL_DELETED_FUNCTION;
 protected:
     // OPropertyChangeListener
-    virtual void    _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
+    virtual void    _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 public:
     OGroupsSortingDialog( vcl::Window* pParent
                         ,bool _bReadOnly
commit f1ad620b918b4eae6d3f92bb4cf5d0822c7264eb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 9 14:37:22 2015 +0100

    coverity#1297236 Uninitialized scalar field
    
    Change-Id: I2c19d1a0f8ad31cdf384ab301f3dae99a6ea9933

diff --git a/framework/source/helper/statusindicator.cxx b/framework/source/helper/statusindicator.cxx
index 6c78d0a..5c9dafc 100644
--- a/framework/source/helper/statusindicator.cxx
+++ b/framework/source/helper/statusindicator.cxx
@@ -23,7 +23,9 @@
 namespace framework{
 
 StatusIndicator::StatusIndicator(StatusIndicatorFactory* pFactory)
-    : m_xFactory         (pFactory)
+    : m_xFactory(pFactory)
+    , m_nRange(100)
+    , m_nLastCallbackPercent(-1)
 {
 }
 
commit 548a6894814c4fd067137d44bb009205911bf8c9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 9 14:14:14 2015 +0100

    VclPtr: fix crash on loading kde86727-1.html
    
    and all the other html crashtest loading failures
    I believe
    
    Change-Id: I38d3e1ad283efc08f468d9062e520149663e3e84

diff --git a/include/svtools/filectrl.hxx b/include/svtools/filectrl.hxx
index bc8c96a..8f6abd2 100644
--- a/include/svtools/filectrl.hxx
+++ b/include/svtools/filectrl.hxx
@@ -102,6 +102,8 @@ public:
     //use this to manipulate the dialog bevore executing it:
     void            SetDialogCreatedHdl( const Link<>& rLink ) { maDialogCreatedHdl = rLink; }
     const Link<>&   GetDialogCreatedHdl() const { return maDialogCreatedHdl; }
+
+    void            SetEditModifyHdl( const Link<>& rLink );
 };
 
 #endif
diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx
index 974edbf..ab07a4a 100644
--- a/svtools/source/control/filectrl.cxx
+++ b/svtools/source/control/filectrl.cxx
@@ -193,14 +193,17 @@ IMPL_LINK_NOARG(FileControl, ButtonHdl)
     return 0;
 }
 
-
-
 void FileControl::GetFocus()
 {
     maEdit->GrabFocus();
 }
 
-
+void FileControl::SetEditModifyHdl( const Link<>& rLink )
+{
+    if (!maEdit || maEdit->IsDisposed())
+        return;
+    maEdit->SetModifyHdl(rLink);
+}
 
 void FileControl::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
 {
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index ac36452..8b9dd52 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -595,11 +595,11 @@ void VCLXFileControl::SetWindow( const VclPtr< vcl::Window > &pWindow )
 {
     VclPtr< FileControl > pPrevFileControl = GetAsDynamic< FileControl >();
     if ( pPrevFileControl )
-        pPrevFileControl->GetEdit().SetModifyHdl( Link<>() );
+        pPrevFileControl->SetEditModifyHdl( Link<>() );
 
     FileControl* pNewFileControl = dynamic_cast<FileControl*>( pWindow.get() );
     if ( pNewFileControl )
-        pNewFileControl->GetEdit().SetModifyHdl( LINK( this, VCLXFileControl, ModifyHdl ) );
+        pNewFileControl->SetEditModifyHdl( LINK( this, VCLXFileControl, ModifyHdl ) );
 
     VCLXWindow::SetWindow( pWindow );
 }


More information about the Libreoffice-commits mailing list