diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-02-29 09:06:13 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-02-29 10:09:44 +0000 |
commit | f57cd61004e5a36749f54a5e368becd756d17668 (patch) | |
tree | 68b01e2bd0e91f103d908e6460c0a369d0c1b333 /vcl | |
parent | move template out of header (diff) | |
download | core-f57cd61004e5a36749f54a5e368becd756d17668.tar.gz core-f57cd61004e5a36749f54a5e368becd756d17668.zip |
SessionManagerClient is never instantiated
the "pThis" is a hack to smuggle an argument into a static method,
its not actually a SessionManagerClient instance, clarify the code
around that
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/sm.hxx | 1 | ||||
-rw-r--r-- | vcl/unx/generic/app/sm.cxx | 16 |
2 files changed, 8 insertions, 9 deletions
diff --git a/vcl/inc/unx/sm.hxx b/vcl/inc/unx/sm.hxx index 3af55f5b0f00..0dfc463884bf 100644 --- a/vcl/inc/unx/sm.hxx +++ b/vcl/inc/unx/sm.hxx @@ -64,7 +64,6 @@ class SessionManagerClient DECL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void* ); DECL_STATIC_LINK( SessionManagerClient, InteractionHdl, void* ); public: - SessionManagerClient(); static VCLPLUG_GEN_PUBLIC void open(); // needed by other plugins, so export static void close(); diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 75af64c72edd..82fd4b141ef1 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -242,11 +242,6 @@ static void BuildSmPropertyList() } } -SessionManagerClient::SessionManagerClient() -{ - SAL_INFO("vcl.sm","SessionManagerClient::SessionManagerClient()"); -} - bool SessionManagerClient::checkDocumentsSaved() { return bDocSaveDone; @@ -254,10 +249,14 @@ bool SessionManagerClient::checkDocumentsSaved() IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, EMPTYARG ) { - SAL_INFO("vcl.sm", "posting save documents event shutdown = " << ((pThis!=0) ? "true" : "false" )); + //decode argument smuggled in by abusing pThis member of SessionManagerClient + sal_uIntPtr nStateVal = (sal_uIntPtr)pThis; + Bool shutdown = nStateVal != 0; + + SAL_INFO("vcl.sm", "posting save documents event shutdown = " << (shutdown ? "true" : "false" )); static bool bFirstShutdown=true; - if (pThis != 0 && bFirstShutdown) //first shutdown request + if (shutdown && bFirstShutdown) //first shutdown request { bFirstShutdown = false; /* @@ -282,7 +281,7 @@ IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, EMPTYARG ) if( pOneInstance ) { - SalSessionSaveRequestEvent aEvent( pThis != 0, false ); + SalSessionSaveRequestEvent aEvent( shutdown, false ); pOneInstance->CallCallback( &aEvent ); } else @@ -348,6 +347,7 @@ void SessionManagerClient::SaveYourselfProc( SessionManagerClient::saveDone(); return; } + //Smuggle argument in by abusing pThis member of SessionManagerClient sal_uIntPtr nStateVal = shutdown ? 0xffffffff : 0x0; Application::PostUserEvent( STATIC_LINK( (void*)nStateVal, SessionManagerClient, SaveYourselfHdl ) ); SAL_INFO("vcl.sm", "waiting for save yourself event to be processed" ); |