diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-06-19 13:08:06 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-06-20 14:44:04 +0200 |
commit | 34a3f6e8b7604612749d4f700a5db6d380bd0829 (patch) | |
tree | 220011aef71068070be35cf0d8884677069c60e1 /vcl/unx | |
parent | c83a393ffe5c80afd18f215f70af3e152d51a6bd (diff) |
Move pOneInstance to SessionManagerClient::m_pSession
Change-Id: I264d978fe3db9ab7eedf79351f70cee194ef792c
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/app/sm.cxx | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 5a05c8db6c46..1f8debf3e209 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -26,6 +26,10 @@ * ************************************************************************/ +#include "sal/config.h" + +#include <cassert> + #include <string.h> #include <unistd.h> #include <sys/poll.h> @@ -52,14 +56,11 @@ #include <vcl/svapp.hxx> #include <vcl/window.hxx> -static IceSalSession* pOneInstance = NULL; - SalSession* X11SalInstance::CreateSalSession() { - if( ! pOneInstance ) - pOneInstance = new IceSalSession(); - SessionManagerClient::open(); - return pOneInstance; + SalSession * p = new IceSalSession; + SessionManagerClient::open(p); + return p; } /* @@ -74,8 +75,6 @@ IceSalSession::IceSalSession() IceSalSession::~IceSalSession() { - if( pOneInstance == this ) - pOneInstance = NULL; } void IceSalSession::queryInteraction() @@ -135,6 +134,7 @@ public: }; +SalSession * SessionManagerClient::m_pSession = 0; SmcConn SessionManagerClient::aSmcConnection = NULL; rtl::OString SessionManagerClient::m_aClientID; sal_Bool ICEConnectionObserver::bIsWatching = sal_False; @@ -273,10 +273,10 @@ IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, SaveYourselfHdl, void*, pStat } } - if( pOneInstance ) + if( m_pSession ) { SalSessionSaveRequestEvent aEvent( shutdown, false ); - pOneInstance->CallCallback( &aEvent ); + m_pSession->CallCallback( &aEvent ); } else saveDone(); @@ -287,10 +287,10 @@ IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, SaveYourselfHdl, void*, pStat IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, InteractionHdl, void*, EMPTYARG ) { SAL_INFO("vcl.sm", "interaction link"); - if( pOneInstance ) + if( m_pSession ) { SalSessionInteractionEvent aEvent( true ); - pOneInstance->CallCallback( &aEvent ); + m_pSession->CallCallback( &aEvent ); } return 0; @@ -299,10 +299,10 @@ IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, InteractionHdl, void*, EMPTYA IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, ShutDownCancelHdl, void*, EMPTYARG ) { SAL_INFO("vcl.sm", "shutdown cancel"); - if( pOneInstance ) + if( m_pSession ) { SalSessionShutdownCancelEvent aEvent; - pOneInstance->CallCallback( &aEvent ); + m_pSession->CallCallback( &aEvent ); } return 0; @@ -348,10 +348,10 @@ void SessionManagerClient::SaveYourselfProc( IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, ShutDownHdl, void*, EMPTYARG ) { - if( pOneInstance ) + if( m_pSession ) { SalSessionQuitEvent aEvent; - pOneInstance->CallCallback( &aEvent ); + m_pSession->CallCallback( &aEvent ); } const std::list< SalFrame* >& rFrames = GetGenericData()->GetSalDisplay()->getFrames(); @@ -414,8 +414,11 @@ void SessionManagerClient::saveDone() } -void SessionManagerClient::open() +void SessionManagerClient::open(SalSession * pSession) { + assert(!m_pSession); + m_pSession = pSession; + static SmcCallbacks aCallbacks; // this is the way Xt does it, so we can too |