Fixed crash, a pointer was deleted twice. Small cleanup, too.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3302 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper 2003-05-24 00:16:23 +00:00
parent 2a5153718e
commit d8d1ef215b

View File

@ -801,47 +801,26 @@ BParameterGroup::BParameterGroup(BParameterWeb *web,
BParameterGroup::~BParameterGroup() BParameterGroup::~BParameterGroup()
{ {
int i; if (mControls) {
int count = mControls->CountItems();
int NumItems; BParameter **items = reinterpret_cast<BParameter **>(mControls->Items());
void **Items; for (int i = 0; i < count; i++)
delete items[i];
if(mControls != NULL) delete mControls;
{ DEBUG_ONLY(mControls = 0);
NumItems = mControls->CountItems();
Items = static_cast<void **>(mControls->Items());
for(i = 0; i < NumItems; i++)
{
if(Items[i] != NULL)
{
delete Items[i];
Items[i] = NULL;
}
}
} }
if(mGroups != NULL) if (mGroups) {
{ int count = mGroups->CountItems();
NumItems = mGroups->CountItems(); BParameterGroup **items = reinterpret_cast<BParameterGroup **>(mGroups->Items());
Items = static_cast<void **>(mControls->Items()); for (int i = 0; i < count; i++)
delete items[i];
for(i = 0; i < NumItems; i++) delete mGroups;
{ DEBUG_ONLY(mGroups = 0);
if(Items[i] != NULL)
{
delete Items[i];
Items[i] = NULL;
}
}
}
if(mName != NULL)
{
delete[] mName;
mName = NULL;
} }
delete [] mName;
DEBUG_ONLY(mName = 0);
} }
/************************************************************* /*************************************************************