CComponentsForm: fix possible segfault

Origin commit data
------------------
Branch: ni/coolstream
Commit: 7fd870a063
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-06-25 (Tue, 25 Jun 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
2013-06-25 10:58:33 +02:00
parent 201d07611c
commit 71884de80e

View File

@@ -195,10 +195,9 @@ void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new
if (!v_cc_items.empty()){ if (!v_cc_items.empty()){
CComponentsItem* old_Item = v_cc_items[cc_item_id]; CComponentsItem* old_Item = v_cc_items[cc_item_id];
if (old_Item){ if (old_Item){
if (old_Item->getParent()){ CComponentsItem * old_parent = old_Item->getParent();
new_cc_Item->setParent(old_Item); new_cc_Item->setParent(old_parent);
new_cc_Item->setIndex(old_Item->getIndex()); new_cc_Item->setIndex(old_parent->getIndex());
}
delete old_Item; delete old_Item;
old_Item = NULL; old_Item = NULL;
v_cc_items[cc_item_id] = new_cc_Item; v_cc_items[cc_item_id] = new_cc_Item;