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/unx | |
parent | 53294e814bb8ac5f28a57f1f325311fa05112d12 (diff) |
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/unx')
-rw-r--r-- | vcl/unx/generic/app/sm.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
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" ); |