Fix for bug 120451 -- clean up the sleep Q entry on quit, so that we don't leave a bad entry there and hose the machine some time later. r=sdagley, sr=beard, a=blizzard

This commit is contained in:
sfraser%netscape.com 2002-01-18 21:40:13 +00:00
Родитель ba7d7597f1
Коммит 0428dc97e3
2 изменённых файлов: 41 добавлений и 7 удалений

Просмотреть файл

@ -735,9 +735,9 @@
<SETTING><NAME>MWLinker_PPC_dontdeadstripinitcode</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_permitmultdefs</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_linkmode</NAME><VALUE>Fast</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_initname</NAME><VALUE>__NSInitialize</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_initname</NAME><VALUE>__JSInitialize</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_mainname</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_termname</NAME><VALUE>__NSTerminate</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_termname</NAME><VALUE>__JSTerminate</VALUE></SETTING>
<!-- Settings for "PPC Mach-O Linker" panel -->
<SETTING><NAME>MWLinker_MachO_exports</NAME><VALUE>None</VALUE></SETTING>
@ -2062,9 +2062,9 @@
<SETTING><NAME>MWLinker_PPC_dontdeadstripinitcode</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_permitmultdefs</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_linkmode</NAME><VALUE>Fast</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_initname</NAME><VALUE>__NSInitialize</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_initname</NAME><VALUE>__JSInitialize</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_mainname</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_termname</NAME><VALUE>__NSTerminate</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_termname</NAME><VALUE>__JSTerminate</VALUE></SETTING>
<!-- Settings for "PPC Mach-O Linker" panel -->
<SETTING><NAME>MWLinker_MachO_exports</NAME><VALUE>None</VALUE></SETTING>

Просмотреть файл

@ -68,6 +68,7 @@
#include <Timer.h>
#include <UTCUtils.h>
#include <Power.h>
#include <CodeFragments.h>
#endif
#if defined(XP_UNIX) || defined(XP_BEOS)
@ -132,7 +133,8 @@ static void MacintoshInitializeTime(void)
JSLL_MUL(dstLocalBaseMicroseconds, oneMillion, startupTimeMicroSeconds);
}
static SleepQRec theSleepQ = { NULL, sleepQType, NULL, 0 };
static SleepQRec gSleepQEntry = { NULL, sleepQType, NULL, 0 };
static JSBool gSleepQEntryInstalled = JS_FALSE;
static pascal long MySleepQProc(long message, SleepQRecPtr sleepQ)
{
@ -155,12 +157,44 @@ static void MyReadLocation(MachineLocation * loc)
MacintoshInitializeTime();
ReadLocation(&storedLoc);
/* install a sleep queue routine, so that when the machine wakes up, time can be recomputed. */
if ((theSleepQ.sleepQProc = NewSleepQUPP(MySleepQProc)) != NULL)
SleepQInstall(&theSleepQ);
if ((gSleepQEntry.sleepQProc = NewSleepQUPP(MySleepQProc)) != NULL) {
SleepQInstall(&gSleepQEntry);
gSleepQEntryInstalled = JS_TRUE;
}
didReadLocation = JS_TRUE;
}
*loc = storedLoc;
}
#ifndef XP_MACOSX
/* CFM library init and terminate routines. We'll use the terminate routine
to clean up the sleep Q entry. On Mach-O, the sleep Q entry gets cleaned
up for us, so nothing to do there.
*/
extern pascal OSErr __NSInitialize(const CFragInitBlock* initBlock);
extern pascal void __NSTerminate();
pascal OSErr __JSInitialize(const CFragInitBlock* initBlock);
pascal void __JSTerminate(void);
pascal OSErr __JSInitialize(const CFragInitBlock* initBlock)
{
return __NSInitialize(initBlock);
}
pascal void __JSTerminate()
{
// clean up the sleepQ entry
if (gSleepQEntryInstalled)
SleepQRemove(&gSleepQEntry);
__NSTerminate();
}
#endif /* XP_MACOSX */
#endif /* XP_MAC */
#define IS_LEAP(year) \