[Libreoffice-commits] .: 4 commits - desktop/source sfx2/inc sfx2/source svx/source

Caolán McNamara caolan at kemper.freedesktop.org
Wed Apr 6 06:16:27 PDT 2011


 desktop/source/migration/pages.cxx  |    8 ++++----
 desktop/source/migration/wizard.cxx |   24 ++++++++++++------------
 sfx2/inc/sfx2/linkmgr.hxx           |    2 +-
 sfx2/source/bastyp/fltfnc.cxx       |    8 +++++++-
 sfx2/source/bastyp/fltlst.cxx       |   36 +++++++++++++++++++++++++++++++++++-
 sfx2/source/bastyp/fltlst.hxx       |   15 +++++----------
 svx/source/form/fmscriptingenv.cxx  |   17 ++++++++---------
 7 files changed, 72 insertions(+), 38 deletions(-)

New commits:
commit f70c4b4112ae5ea204b6d063ecf111fdf002d872
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 6 14:15:57 2011 +0100

    fix build error from bad merge

diff --git a/sfx2/inc/sfx2/linkmgr.hxx b/sfx2/inc/sfx2/linkmgr.hxx
index 0ea1494..6690cae 100644
--- a/sfx2/inc/sfx2/linkmgr.hxx
+++ b/sfx2/inc/sfx2/linkmgr.hxx
@@ -170,7 +170,7 @@ public:
     // got the appropriate information as a string.
     // Is now required for FileObject in conjunction with JavaScript  
     // this needs information about Load/Abort/Error
-    static ULONG  RegisterStatusInfoId();
+    static sal_uIntPtr RegisterStatusInfoId();
 
     // if the mimetype says graphic/bitmap/gdimetafile then get the
     // graphic from the Any. Return says no errors
commit c0186e4d0fc9c5b359382fbb79f7446a7c0a5d2e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 6 13:46:41 2011 +0100

    fix ownership cycle

diff --git a/svx/source/form/fmscriptingenv.cxx b/svx/source/form/fmscriptingenv.cxx
index 3bc83a4..5870c66 100644
--- a/svx/source/form/fmscriptingenv.cxx
+++ b/svx/source/form/fmscriptingenv.cxx
@@ -95,11 +95,11 @@ namespace svxform
     class FormScriptListener    :public FormScriptListener_Base
     {
     private:
-        ::osl::Mutex                                            m_aMutex;
-        ::rtl::Reference< FormScriptingEnvironment >            m_pScriptExecutor;
+        ::osl::Mutex m_aMutex;
+        FormScriptingEnvironment *m_pScriptExecutor;
 
     public:
-        FormScriptListener( const ::rtl::Reference< FormScriptingEnvironment >& _pScriptExecutor );
+        FormScriptListener( FormScriptingEnvironment * pScriptExecutor );
 
         // XScriptListener
         virtual void SAL_CALL firing( const ScriptEvent& aEvent ) throw (RuntimeException);
@@ -128,7 +128,7 @@ namespace svxform
 
         /** determines whether the instance is already disposed
         */
-        bool    impl_isDisposed_nothrow() const { return !m_pScriptExecutor.is(); }
+        bool    impl_isDisposed_nothrow() const { return !m_pScriptExecutor; }
 
         /** fires the given script event in a thread-safe manner
 
@@ -195,8 +195,8 @@ namespace svxform
     //= FormScriptListener
     //====================================================================
     //--------------------------------------------------------------------
-    FormScriptListener::FormScriptListener( const ::rtl::Reference< FormScriptingEnvironment >& _pScriptExecutor )
-        :m_pScriptExecutor( _pScriptExecutor )
+    FormScriptListener::FormScriptListener( FormScriptingEnvironment* pScriptExecutor )
+        :m_pScriptExecutor( pScriptExecutor )
     {
     }
 
@@ -231,11 +231,10 @@ namespace svxform
     //--------------------------------------------------------------------
     void FormScriptListener::impl_doFireScriptEvent_nothrow( ::osl::ClearableMutexGuard& _rGuard, const ScriptEvent& _rEvent, Any* _pSyncronousResult )
     {
-        OSL_PRECOND( m_pScriptExecutor.is(), "FormScriptListener::impl_doFireScriptEvent_nothrow: this will crash!" );
+        OSL_PRECOND( m_pScriptExecutor, "FormScriptListener::impl_doFireScriptEvent_nothrow: this will crash!" );
 
-        ::rtl::Reference< FormScriptingEnvironment > pExecutor( m_pScriptExecutor );
         _rGuard.clear();
-        pExecutor->doFireScriptEvent( _rEvent, _pSyncronousResult );
+        m_pScriptExecutor->doFireScriptEvent( _rEvent, _pSyncronousResult );
     }
 
     //--------------------------------------------------------------------
commit 004ec12840e6a56d6b6e8331b8176618ba4c72a0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 6 13:43:46 2011 +0100

    fix ownership cycle and leak

diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 93fb392..42a9203 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -92,6 +92,7 @@
 #include <tools/urlobj.hxx>
 
 #include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::ucb;
@@ -122,13 +123,18 @@ using namespace ::com::sun::star::beans;
 #include <sfx2/appuno.hxx>
 #include <sfx2/viewfrm.hxx>
 
+namespace
+{
+    class theSfxFilterListener : public rtl::Static<SfxFilterListener, theSfxFilterListener> {};
+}
+
 static SfxFilterList_Impl* pFilterArr = 0;
 static sal_Bool bFirstRead = sal_True;
 
 static void CreateFilterArr()
 {
     pFilterArr = new SfxFilterList_Impl;
-    new SfxFilterListener();
+    theSfxFilterListener::get();
 }
 
 //----------------------------------------------------------------
diff --git a/sfx2/source/bastyp/fltlst.cxx b/sfx2/source/bastyp/fltlst.cxx
index 1c84fda..ba3cfa2 100644
--- a/sfx2/source/bastyp/fltlst.cxx
+++ b/sfx2/source/bastyp/fltlst.cxx
@@ -49,6 +49,39 @@
 //*****************************************************************************************************************
 using namespace ::com::sun::star;
 
+
+class SfxRefreshListener : public ::cppu::WeakImplHelper1<com::sun::star::util::XRefreshListener>
+{
+    private:
+        SfxFilterListener *m_pOwner;
+
+    public:
+        SfxRefreshListener(SfxFilterListener *pOwner)
+            : m_pOwner(pOwner)
+        {
+        }
+
+        virtual ~SfxRefreshListener()
+        {
+        }
+
+        // util.XRefreshListener
+        virtual void SAL_CALL refreshed( const ::com::sun::star::lang::EventObject& rEvent )
+            throw(com::sun::star::uno::RuntimeException)
+        {
+            m_pOwner->refreshed(rEvent);
+        }
+
+        // lang.XEventListener
+        virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject& rEvent)
+            throw(com::sun::star::uno::RuntimeException)
+        {
+            m_pOwner->disposing(rEvent);
+        }
+};
+
+
+
 //*****************************************************************************************************************
 //  definitions
 //*****************************************************************************************************************
@@ -85,7 +118,8 @@ SfxFilterListener::SfxFilterListener()
         if( xNotifier.is() == sal_True )
         {
             m_xFilterCache = xNotifier;
-            m_xFilterCache->addRefreshListener( this );
+            m_xFilterCacheListener = new SfxRefreshListener(this);
+            m_xFilterCache->addRefreshListener( m_xFilterCacheListener );
         }
     }
 }
diff --git a/sfx2/source/bastyp/fltlst.hxx b/sfx2/source/bastyp/fltlst.hxx
index b775d9d..85993b2 100644
--- a/sfx2/source/bastyp/fltlst.hxx
+++ b/sfx2/source/bastyp/fltlst.hxx
@@ -42,28 +42,23 @@
 #include <com/sun/star/lang/EventObject.hpp>
 #include <com/sun/star/uno/RuntimeException.hpp>
 
-//*****************************************************************************************************************
-//  declarations
-//*****************************************************************************************************************
-class SfxFilterListener : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XRefreshListener >
+class SfxFilterListener
 {
-    // member
     private:
         ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable >  m_xFilterCache;
+        ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >  m_xFilterCacheListener;
 
-    // c++ interface
     public:
-              SfxFilterListener();
-             ~SfxFilterListener();
+        SfxFilterListener();
+        ~SfxFilterListener();
 
-    // uno interface
     public:
         // XRefreshListener
         virtual void SAL_CALL refreshed( const ::com::sun::star::lang::EventObject& aSource ) throw( ::com::sun::star::uno::RuntimeException );
         // XEventListener
         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aSource ) throw( ::com::sun::star::uno::RuntimeException );
 
-};  // SfxFilterListener
+};
 
 #endif // _SFX_FLTLST_HXX
 
commit dd44a9c45cf4c17d74de93bcd38155d598ea0ae9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 6 09:47:55 2011 +0100

    createFromAscii -> RTL_CONSTASCII_USTRINGPARAM

diff --git a/desktop/source/migration/pages.cxx b/desktop/source/migration/pages.cxx
index 291ec4d..c9c4f74 100644
--- a/desktop/source/migration/pages.cxx
+++ b/desktop/source/migration/pages.cxx
@@ -117,7 +117,7 @@ void WelcomePage::checkEval()
 {
     Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
     Reference< XMaterialHolder > xHolder(xFactory->createInstance(
-        OUString::createFromAscii("com.sun.star.tab.tabreg")), UNO_QUERY);
+        OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.tab.tabreg"))), UNO_QUERY);
     if (xHolder.is()) {
         Any aData = xHolder->getMaterial();
         Sequence < NamedValue > aSeq;
@@ -562,9 +562,9 @@ void RegistrationPage::ActivatePage()
 
 void RegistrationPage::impl_retrieveConfigurationData()
 {
-    static ::rtl::OUString PACKAGE = ::rtl::OUString::createFromAscii("org.openoffice.FirstStartWizard");
-    static ::rtl::OUString PATH    = ::rtl::OUString::createFromAscii("TabPages/Registration/RegistrationOptions/NeverButton");
-    static ::rtl::OUString KEY     = ::rtl::OUString::createFromAscii("Visible");
+    static ::rtl::OUString PACKAGE(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.FirstStartWizard"));
+    static ::rtl::OUString PATH(RTL_CONSTASCII_USTRINGPARAM("TabPages/Registration/RegistrationOptions/NeverButton"));
+    static ::rtl::OUString KEY(RTL_CONSTASCII_USTRINGPARAM("Visible"));
 
     ::com::sun::star::uno::Any aValue;
     try
diff --git a/desktop/source/migration/wizard.cxx b/desktop/source/migration/wizard.cxx
index 47f3fcd..b8931bb 100644
--- a/desktop/source/migration/wizard.cxx
+++ b/desktop/source/migration/wizard.cxx
@@ -447,15 +447,15 @@ void FirstStartWizard::storeAcceptDate()
         Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
         xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
         Sequence< Any > theArgs(1);
-        NamedValue v(OUString::createFromAscii("NodePath"), 
-            makeAny(OUString::createFromAscii("org.openoffice.Setup/Office")));
+        NamedValue v(OUString(RTL_CONSTASCII_USTRINGPARAM("NodePath")),
+            makeAny(OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Setup/Office"))));
         theArgs[0] <<= v;
         Reference< XPropertySet > pset = Reference< XPropertySet >(
             theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW);
-        Any result = pset->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate"));
+        Any result = pset->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("LicenseAcceptDate")));
 
         OUString aAcceptDate = _getCurrentDateString();
-        pset->setPropertyValue(OUString::createFromAscii("LicenseAcceptDate"), makeAny(aAcceptDate));
+        pset->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("LicenseAcceptDate")), makeAny(aAcceptDate));
         Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges();
 
         // since the license is accepted the local user registry can be cleaned if required
@@ -474,16 +474,16 @@ void FirstStartWizard::setPatchLevel()
         Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
         xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
         Sequence< Any > theArgs(1);
-        NamedValue v(OUString::createFromAscii("NodePath"), 
-            makeAny(OUString::createFromAscii("org.openoffice.Office.Common/Help/Registration")));
+        NamedValue v(OUString(RTL_CONSTASCII_USTRINGPARAM("NodePath")),
+            makeAny(OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/Help/Registration"))));
         theArgs[0] <<= v;
         Reference< XPropertySet > pset = Reference< XPropertySet >(
             theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW);
-        Any result = pset->getPropertyValue(OUString::createFromAscii("ReminderDate"));
+        Any result = pset->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("ReminderDate")));
 
         OUString aPatchLevel( RTL_CONSTASCII_USTRINGPARAM( "Patch" ));
         aPatchLevel += OUString::valueOf( getBuildId(), 10 );
-        pset->setPropertyValue(OUString::createFromAscii("ReminderDate"), makeAny(aPatchLevel));
+        pset->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("ReminderDate")), makeAny(aPatchLevel));
         Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges();
     } catch (const Exception&)
     {
@@ -546,12 +546,12 @@ void FirstStartWizard::disableWizard()
         Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
         xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
         Sequence< Any > theArgs(1);
-        NamedValue v(OUString::createFromAscii("NodePath"), 
-            makeAny(OUString::createFromAscii("org.openoffice.Setup/Office")));
+        NamedValue v(OUString(RTL_CONSTASCII_USTRINGPARAM("NodePath")),
+            makeAny(OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Setup/Office"))));
         theArgs[0] <<= v;
         Reference< XPropertySet > pset = Reference< XPropertySet >(
             theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW);
-        pset->setPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted"), makeAny(sal_True));
+        pset->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("FirstStartWizardCompleted")), makeAny(sal_True));
         Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges();
     } catch (const Exception&)
     {
@@ -569,7 +569,7 @@ void FirstStartWizard::enableQuickstart()
     aSeq[1] <<= bAutostart;
 
     Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance(
-        OUString::createFromAscii( "com.sun.star.office.Quickstart" )),UNO_QUERY );
+        OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.office.Quickstart"))),UNO_QUERY );
     if ( xQuickstart.is() )
         xQuickstart->initialize( aSeq );
 


More information about the Libreoffice-commits mailing list