* Fixed some memory leaks when using the BMessageRunners.

* Now quits the window directly, instead of letting the application destructor do that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17756 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-06-07 13:51:33 +00:00
parent 41158aaf91
commit d0e9fa680e
2 changed files with 21 additions and 9 deletions

View File

@ -137,7 +137,9 @@ void
ScreenBlanker::_QueueResumeScreenSaver()
{
delete fResumeRunner;
fResumeRunner = new BMessageRunner(BMessenger(this), new BMessage(kMsgResumeSaver),
BMessage resume(kMsgResumeSaver);
fResumeRunner = new BMessageRunner(BMessenger(this), &resume,
fSettings.BlankTime(), 1);
if (fResumeRunner->InitCheck() != B_OK)
syslog(LOG_ERR, "resume screen saver runner failed\n");
@ -178,22 +180,25 @@ ScreenBlanker::_QueueTurnOffScreen()
// start them off again
if (flags & ENABLE_DPMS_STAND_BY) {
fStandByScreenRunner = new BMessageRunner(BMessenger(this),
new BMessage(kMsgStandByScreen), fSettings.StandByTime(), 1);
BMessage dpms(kMsgStandByScreen);
fStandByScreenRunner = new BMessageRunner(BMessenger(this), &dpms,
fSettings.StandByTime(), 1);
if (fStandByScreenRunner->InitCheck() != B_OK)
syslog(LOG_ERR, "standby screen saver runner failed\n");
}
if (flags & ENABLE_DPMS_SUSPEND) {
fSuspendScreenRunner = new BMessageRunner(BMessenger(this),
new BMessage(kMsgSuspendScreen), fSettings.SuspendTime(), 1);
BMessage dpms(kMsgSuspendScreen);
fSuspendScreenRunner = new BMessageRunner(BMessenger(this), &dpms,
fSettings.SuspendTime(), 1);
if (fSuspendScreenRunner->InitCheck() != B_OK)
syslog(LOG_ERR, "turn off screen saver runner failed\n");
}
if (flags & ENABLE_DPMS_OFF) {
fTurnOffScreenRunner = new BMessageRunner(BMessenger(this),
new BMessage(kMsgTurnOffScreen), fSettings.OffTime(), 1);
BMessage dpms(kMsgTurnOffScreen);
fTurnOffScreenRunner = new BMessageRunner(BMessenger(this), &dpms,
fSettings.OffTime(), 1);
if (fTurnOffScreenRunner->InitCheck() != B_OK)
syslog(LOG_ERR, "turn off screen saver runner failed\n");
}
@ -269,8 +274,12 @@ ScreenBlanker::_Shutdown()
{
delete fRunner;
if (fWindow)
if (fWindow) {
fWindow->Hide();
if (fWindow->Lock())
fWindow->Quit();
}
}

View File

@ -10,9 +10,11 @@
#include "ScreenSaverWindow.h"
#include <View.h>
#include <WindowPrivate.h>
#include <Application.h>
#include <View.h>
/*!
This is the BDirectWindow subclass that rendering occurs in.
@ -46,6 +48,7 @@ ScreenSaverWindow::SetSaver(BScreenSaver *saver)
bool
ScreenSaverWindow::QuitRequested()
{
be_app->PostMessage(B_QUIT_REQUESTED);
return true;
}