Kaydet (Commit) f57cd610 authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst 53294e81
...@@ -64,7 +64,6 @@ class SessionManagerClient ...@@ -64,7 +64,6 @@ class SessionManagerClient
DECL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void* ); DECL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void* );
DECL_STATIC_LINK( SessionManagerClient, InteractionHdl, void* ); DECL_STATIC_LINK( SessionManagerClient, InteractionHdl, void* );
public: public:
SessionManagerClient();
static VCLPLUG_GEN_PUBLIC void open(); // needed by other plugins, so export static VCLPLUG_GEN_PUBLIC void open(); // needed by other plugins, so export
static void close(); static void close();
......
...@@ -242,11 +242,6 @@ static void BuildSmPropertyList() ...@@ -242,11 +242,6 @@ static void BuildSmPropertyList()
} }
} }
SessionManagerClient::SessionManagerClient()
{
SAL_INFO("vcl.sm","SessionManagerClient::SessionManagerClient()");
}
bool SessionManagerClient::checkDocumentsSaved() bool SessionManagerClient::checkDocumentsSaved()
{ {
return bDocSaveDone; return bDocSaveDone;
...@@ -254,10 +249,14 @@ bool SessionManagerClient::checkDocumentsSaved() ...@@ -254,10 +249,14 @@ bool SessionManagerClient::checkDocumentsSaved()
IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, EMPTYARG ) 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; static bool bFirstShutdown=true;
if (pThis != 0 && bFirstShutdown) //first shutdown request if (shutdown && bFirstShutdown) //first shutdown request
{ {
bFirstShutdown = false; bFirstShutdown = false;
/* /*
...@@ -282,7 +281,7 @@ IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, EMPTYARG ) ...@@ -282,7 +281,7 @@ IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, EMPTYARG )
if( pOneInstance ) if( pOneInstance )
{ {
SalSessionSaveRequestEvent aEvent( pThis != 0, false ); SalSessionSaveRequestEvent aEvent( shutdown, false );
pOneInstance->CallCallback( &aEvent ); pOneInstance->CallCallback( &aEvent );
} }
else else
...@@ -348,6 +347,7 @@ void SessionManagerClient::SaveYourselfProc( ...@@ -348,6 +347,7 @@ void SessionManagerClient::SaveYourselfProc(
SessionManagerClient::saveDone(); SessionManagerClient::saveDone();
return; return;
} }
//Smuggle argument in by abusing pThis member of SessionManagerClient
sal_uIntPtr nStateVal = shutdown ? 0xffffffff : 0x0; sal_uIntPtr nStateVal = shutdown ? 0xffffffff : 0x0;
Application::PostUserEvent( STATIC_LINK( (void*)nStateVal, SessionManagerClient, SaveYourselfHdl ) ); Application::PostUserEvent( STATIC_LINK( (void*)nStateVal, SessionManagerClient, SaveYourselfHdl ) );
SAL_INFO("vcl.sm", "waiting for save yourself event to be processed" ); SAL_INFO("vcl.sm", "waiting for save yourself event to be processed" );
......
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