diff --git a/src/kits/media/ParameterWeb.cpp b/src/kits/media/ParameterWeb.cpp index 8d7a3c99e0..d8da58968c 100644 --- a/src/kits/media/ParameterWeb.cpp +++ b/src/kits/media/ParameterWeb.cpp @@ -801,47 +801,26 @@ BParameterGroup::BParameterGroup(BParameterWeb *web, BParameterGroup::~BParameterGroup() { - int i; - - int NumItems; - void **Items; - - if(mControls != NULL) - { - NumItems = mControls->CountItems(); - Items = static_cast(mControls->Items()); - - for(i = 0; i < NumItems; i++) - { - if(Items[i] != NULL) - { - delete Items[i]; - Items[i] = NULL; - } - } - } - - if(mGroups != NULL) - { - NumItems = mGroups->CountItems(); - Items = static_cast(mControls->Items()); - - for(i = 0; i < NumItems; i++) - { - if(Items[i] != NULL) - { - delete Items[i]; - Items[i] = NULL; - } - } + if (mControls) { + int count = mControls->CountItems(); + BParameter **items = reinterpret_cast(mControls->Items()); + for (int i = 0; i < count; i++) + delete items[i]; + delete mControls; + DEBUG_ONLY(mControls = 0); } - if(mName != NULL) - { - delete[] mName; - mName = NULL; + if (mGroups) { + int count = mGroups->CountItems(); + BParameterGroup **items = reinterpret_cast(mGroups->Items()); + for (int i = 0; i < count; i++) + delete items[i]; + delete mGroups; + DEBUG_ONLY(mGroups = 0); } - + + delete [] mName; + DEBUG_ONLY(mName = 0); } /*************************************************************