[Libreoffice-commits] core.git: vcl/source

Stephan Bergmann sbergman at redhat.com
Thu Dec 10 04:38:16 PST 2015


 vcl/source/app/session.cxx |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

New commits:
commit 8c87cfc252ed0bddc99ca1bc201234c3bb041a99
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Dec 10 13:37:46 2015 +0100

    Remove listeners upon dispose
    
    Change-Id: I9cee05fe75ba87da98ee3d4616099583fa03470d

diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx
index cca093b..96d243e 100644
--- a/vcl/source/app/session.cxx
+++ b/vcl/source/app/session.cxx
@@ -82,6 +82,8 @@ class VCLSession:
     virtual void SAL_CALL saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException, std::exception ) override;
     virtual sal_Bool SAL_CALL cancelShutdown() throw( RuntimeException, std::exception ) override;
 
+    void SAL_CALL disposing() override;
+
     void callSaveRequested( bool bShutdown, bool bCancelable );
     void callShutdownCancelled();
     void callInteractionGranted( bool bGranted );
@@ -327,6 +329,22 @@ sal_Bool SAL_CALL VCLSession::cancelShutdown() throw( RuntimeException, std::exc
     return m_xSession && m_xSession->cancelShutdown();
 }
 
+void VCLSession::disposing() {
+    std::list<Listener> list;
+    {
+        osl::MutexGuard g(m_aMutex);
+        list.swap(m_aListeners);
+    }
+    css::lang::EventObject src(static_cast<OWeakObject *>(this));
+    for (auto const & i: list) {
+        try {
+            i.m_xListener->disposing(src);
+        } catch (css::uno::RuntimeException & e) {
+            SAL_WARN("vcl.app", "ignoring RuntimeException " << e.Message);
+        }
+    }
+}
+
 // service implementation
 
 OUString SAL_CALL vcl_session_getImplementationName()


More information about the Libreoffice-commits mailing list