1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

dtsession: don't exit while processing your own session exit event.

Setup a global that protects against accidentally exiting
while doing session exit related housekeeping.
This commit is contained in:
Jon Trulson 2012-07-12 13:09:22 -06:00
parent 23930d1b35
commit dc5d68afba
4 changed files with 31 additions and 6 deletions

View file

@ -336,6 +336,9 @@ typedef struct
specific display, otherwise False */ specific display, otherwise False */
Boolean loggingOut; /* Is True if the current save is for Boolean loggingOut; /* Is True if the current save is for
a logout; False otherwise. */ a logout; False otherwise. */
Boolean ExitComplete; /* JET - don't exit before we are ready... */
} GeneralData; } GeneralData;

View file

@ -2564,12 +2564,19 @@ void
SmExit ( SmExit (
int exitStatus) int exitStatus)
{ {
if (smXSMP.saveState.saveComplete && /* JET - needed to rework this to avoid exiting before we are
smXSMP.saveState.shutdown && * *really* ready to
!smXSMP.saveState.shutdownCanceled) */
XSMPExit (); if (smGD.ExitComplete)
{
exit (exitStatus); if (smXSMP.saveState.saveComplete &&
smXSMP.saveState.shutdown &&
!smXSMP.saveState.shutdownCanceled)
XSMPExit ();
exit(exitStatus);
}
else
return;
} }
void void

View file

@ -171,6 +171,9 @@ main (int argc,
smGD.smState = IN_PROCESS; smGD.smState = IN_PROCESS;
smGD.programName = strdup (argv[0]); smGD.programName = strdup (argv[0]);
/* JET - By default, we always want to leave when SmExit() is called. */
smGD.ExitComplete = True;
/* /*
* We report some errors before we call the DtInitialize procedure. * We report some errors before we call the DtInitialize procedure.
* The Dt initialize procedure sets this name. If we report * The Dt initialize procedure sets this name. If we report

View file

@ -1208,6 +1208,11 @@ ImmediateExit(
smGD.loggingOut = True; smGD.loggingOut = True;
/* JET - set this here so we don't exit prematurely (while
* handling our own SM exit callback - duh).
*/
smGD.ExitComplete = False;
saveTimeout = False; saveTimeout = False;
timerId = XtAppAddTimeOut (smGD.appCon, smRes.saveYourselfTimeout, timerId = XtAppAddTimeOut (smGD.appCon, smRes.saveYourselfTimeout,
SaveTimeout, NULL); SaveTimeout, NULL);
@ -1221,6 +1226,13 @@ ImmediateExit(
XtDispatchEvent(&next); XtDispatchEvent(&next);
} }
} }
/* JET - need this, since dtsession was exiting in the
* XtAppNextEvent above (receiving it's own EXIT SM message) This
* is checked in SmExit() so exit's will only occur after this
* housekeeping has been completed.
*/
smGD.ExitComplete = True;
if (smXSMP.saveState.shutdownCanceled == False) { if (smXSMP.saveState.shutdownCanceled == False) {
/* /*