* cleaned up fPulseRunner stuff, I have no idea why fPulseEnabled was
useful... so I removed it * fixed memory leak with SetPulseRate(0), fPulseRunner is now properly freed in the Window destructor * fTitle is now freed as well * fix some potential leaks in BView destructor as well I wrote a stress test app, which I'm soon going to commit as well... it shows that not all memory leaks are fixed by this patch, I could use some help with this... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16713 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4316cb15fa
commit
ecf9f94800
@ -318,7 +318,7 @@ private:
|
||||
BButton *fDefaultButton;
|
||||
BList fShortcuts;
|
||||
int32 fTopViewToken;
|
||||
bool fPulseEnabled;
|
||||
bool _unused2; // was fPulseEnabled
|
||||
bool fViewsNeedPulse; // not yet used
|
||||
bool fIsFilePanel;
|
||||
bool fMaskActivated;
|
||||
@ -326,7 +326,7 @@ private:
|
||||
bool fWaitingForMenu;
|
||||
bool fMinimized;
|
||||
bool fNoQuitShortcut;
|
||||
bool _unused2;
|
||||
bool _unused3;
|
||||
sem_id fMenuSem;
|
||||
float fMaxZoomHeight;
|
||||
float fMaxZoomWidth;
|
||||
|
@ -565,6 +565,7 @@ BView::~BView()
|
||||
|
||||
SetName(NULL);
|
||||
|
||||
removeCommArray();
|
||||
delete fState;
|
||||
}
|
||||
|
||||
@ -809,7 +810,7 @@ BView::SetFlags(uint32 flags)
|
||||
if (fOwner) {
|
||||
if (flags & B_PULSE_NEEDED) {
|
||||
check_lock_no_pick();
|
||||
if (!fOwner->fPulseEnabled)
|
||||
if (fOwner->fPulseRunner == NULL)
|
||||
fOwner->SetPulseRate(500000);
|
||||
}
|
||||
|
||||
@ -2996,9 +2997,7 @@ BView::EndLineArray()
|
||||
|
||||
_FlushIfNotInTransaction();
|
||||
|
||||
delete [] comm->array;
|
||||
delete comm;
|
||||
comm = NULL;
|
||||
removeCommArray();
|
||||
}
|
||||
|
||||
|
||||
@ -4120,7 +4119,7 @@ BView::_Attach()
|
||||
if (fOwner) {
|
||||
if (fFlags & B_PULSE_NEEDED) {
|
||||
check_lock_no_pick();
|
||||
if (!fOwner->fPulseEnabled)
|
||||
if (fOwner->fPulseRunner == NULL)
|
||||
fOwner->SetPulseRate(500000);
|
||||
}
|
||||
}
|
||||
|
@ -326,6 +326,7 @@ BWindow::~BWindow()
|
||||
}
|
||||
|
||||
// TODO: release other dynamically-allocated objects
|
||||
free(fTitle);
|
||||
|
||||
// Deleting this semaphore will tell open menus to quit.
|
||||
if (fMenuSem > 0)
|
||||
@ -960,7 +961,7 @@ FrameMoved(origin);
|
||||
}
|
||||
|
||||
case B_PULSE:
|
||||
if (target == this && fPulseEnabled) {
|
||||
if (target == this && fPulseRunner) {
|
||||
fTopView->_Pulse();
|
||||
fLink->Flush();
|
||||
} else
|
||||
@ -1332,28 +1333,23 @@ void
|
||||
BWindow::SetPulseRate(bigtime_t rate)
|
||||
{
|
||||
// TODO: What about locking?!?
|
||||
if (rate < 0)
|
||||
if (rate < 0 || rate == fPulseRate)
|
||||
return;
|
||||
|
||||
// ToDo: isn't fPulseRunner enough? Why fPulseEnabled?
|
||||
if (fPulseRate == 0 && !fPulseEnabled) {
|
||||
fPulseRunner = new BMessageRunner(BMessenger(this),
|
||||
new BMessage(B_PULSE), rate);
|
||||
fPulseRate = rate;
|
||||
fPulseEnabled = true;
|
||||
return;
|
||||
}
|
||||
fPulseRate = rate;
|
||||
|
||||
if (rate == 0 && fPulseEnabled) {
|
||||
if (rate > 0) {
|
||||
if (fPulseRunner == NULL) {
|
||||
fPulseRunner = new BMessageRunner(BMessenger(this),
|
||||
new BMessage(B_PULSE), rate);
|
||||
} else {
|
||||
fPulseRunner->SetInterval(rate);
|
||||
}
|
||||
} else {
|
||||
// rate == 0
|
||||
delete fPulseRunner;
|
||||
fPulseRunner = NULL;
|
||||
|
||||
fPulseRate = rate;
|
||||
fPulseEnabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
fPulseRunner->SetInterval(rate);
|
||||
}
|
||||
|
||||
|
||||
@ -2199,7 +2195,6 @@ BWindow::_InitData(BRect frame, const char* title, window_look look,
|
||||
AddShortcut('V', B_COMMAND_KEY, new BMessage(B_PASTE), NULL);
|
||||
AddShortcut('A', B_COMMAND_KEY, new BMessage(B_SELECT_ALL), NULL);
|
||||
|
||||
fPulseEnabled = false;
|
||||
fPulseRate = 0;
|
||||
fPulseRunner = NULL;
|
||||
|
||||
@ -2234,6 +2229,7 @@ BWindow::_InitData(BRect frame, const char* title, window_look look,
|
||||
|
||||
port_id receivePort = create_port(B_LOOPER_PORT_DEFAULT_CAPACITY, "w<app_server");
|
||||
if (receivePort < B_OK) {
|
||||
// TODO: huh?
|
||||
debugger("Could not create BWindow's receive port, used for interacting with the app_server!");
|
||||
delete this;
|
||||
return;
|
||||
@ -3137,7 +3133,6 @@ BWindow::PrintToStream() const
|
||||
*/
|
||||
printf("\
|
||||
topViewToken = %ld\
|
||||
pluseEnabled = %s\
|
||||
isFilePanel = %s\
|
||||
MaskActivated = %s\
|
||||
pulseRate = %lld\
|
||||
@ -3156,7 +3151,6 @@ BWindow::PrintToStream() const
|
||||
lastViewToken = %ld\
|
||||
pulseRunner = %s\n",
|
||||
fTopViewToken,
|
||||
fPulseEnabled==true?"Yes":"No",
|
||||
fIsFilePanel==true?"Yes":"No",
|
||||
fMaskActivated==true?"Yes":"No",
|
||||
fPulseRate,
|
||||
|
Loading…
Reference in New Issue
Block a user