CComponentsHeader: ensure clean object on reinit

Items were destroyed with simple call of delete
but not removed from item collection.
removeCCItem() does this and destroys item objects too.


Origin commit data
------------------
Commit: b205b0c8d0
Author: Thilo Graf <dbt@novatux.de>
Date: 2016-09-24 (Sat, 24 Sep 2016)
This commit is contained in:
2016-09-24 00:14:35 +02:00
parent e1c928520d
commit 3f514865ac

View File

@@ -86,6 +86,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
fb_pixel_t color_shadow) fb_pixel_t color_shadow)
{ {
cc_item_type = CC_ITEMTYPE_FRM_HEADER; cc_item_type = CC_ITEMTYPE_FRM_HEADER;
clear();
cc_txt_save_screen = false; cc_txt_save_screen = false;
x = x_old = x_pos; x = x_old = x_pos;
y = y_old = y_pos; y = y_old = y_pos;
@@ -203,10 +204,8 @@ void CComponentsHeader::initIcon()
//init cch_icon_obj only if an icon available //init cch_icon_obj only if an icon available
if (cch_icon_name.empty()) { if (cch_icon_name.empty()) {
cch_icon_w = 0; cch_icon_w = 0;
if (cch_icon_obj){ if (cch_icon_obj)
delete cch_icon_obj; removeCCItem(cch_icon_obj);
cch_icon_obj = NULL;
}
return; return;
} }