Kaydet (Commit) 8c87cfc2 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Remove listeners upon dispose

Change-Id: I9cee05fe75ba87da98ee3d4616099583fa03470d
üst c88c1871
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment