* Fixed memory leak in StressTest and BWindow: they both did not delete the

message they passed to a BMessageRunner object.
* Added note about the ownership of the message to the BMessageRunner
  documentation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16751 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-03-12 22:35:36 +00:00
parent ce0be66ff4
commit 3dd881e3af
3 changed files with 12 additions and 6 deletions

View File

@ -23,7 +23,8 @@ using namespace BPrivate;
The target for replies to the delivered message(s) is \c be_app_messenger.
The success of the initialization can (and should) be asked for via
InitCheck().
InitCheck(). This object will not take ownership of the \a message, you
may freely change or delete it after creation.
\note As soon as the last message has been sent, the message runner
becomes unusable. InitCheck() will still return \c B_OK, but
@ -50,7 +51,8 @@ BMessageRunner::BMessageRunner(BMessenger target, const BMessage *message,
replies to the delivered message(s).
The success of the initialization can (and should) be asked for via
InitCheck().
InitCheck(). This object will not take ownership of the \a message, you
may freely change or delete it after creation.
\note As soon as the last message has been sent, the message runner
becomes unusable. InitCheck() will still return \c B_OK, but
@ -77,7 +79,8 @@ BMessageRunner::BMessageRunner(BMessenger target, const BMessage *message,
The target for replies to the delivered message(s) is \c be_app_messenger.
The success of the initialization can (and should) be asked for via
InitCheck().
InitCheck(). This object will not take ownership of the \a message, you
may freely change or delete it after creation.
\note As soon as the last message has been sent, the message runner
becomes unusable. InitCheck() will still return \c B_OK, but
@ -111,7 +114,8 @@ BMessageRunner::BMessageRunner(BMessenger target, const BMessage *message,
replies to the delivered message(s).
The success of the initialization can (and should) be asked for via
InitCheck().
InitCheck(). This object will not take ownership of the \a message, you
may freely change or delete it after creation.
\note As soon as the last message has been sent, the message runner
becomes unusable. InitCheck() will still return \c B_OK, but

View File

@ -1340,8 +1340,9 @@ BWindow::SetPulseRate(bigtime_t rate)
if (rate > 0) {
if (fPulseRunner == NULL) {
BMessage message(B_PULSE);
fPulseRunner = new BMessageRunner(BMessenger(this),
new BMessage(B_PULSE), rate);
&message, rate);
} else {
fPulseRunner->SetInterval(rate);
}

View File

@ -102,7 +102,8 @@ TestWindow::TestWindow(BRect frame)
Show();
BMessenger self(this);
fPulse = new BMessageRunner(self, new BMessage(B_QUIT_REQUESTED), 10000000, 1);
BMessage message(B_QUIT_REQUESTED);
fPulse = new BMessageRunner(self, &message, 10000000, 1);
}