cc_frm_button.cpp: dont create cc_btn_icon_obj with empty cc_btn_icon, avoid segfault with doble delete - delete cc_btn_icon_obj and CComponentsForm::clear()

Origin commit data
------------------
Commit: 07f8d789fa
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2021-11-06 (Sat, 06 Nov 2021)

Origin message was:
------------------
cc_frm_button.cpp: dont create cc_btn_icon_obj with empty cc_btn_icon, avoid segfault with doble delete - delete cc_btn_icon_obj and CComponentsForm::clear()
This commit is contained in:
Jacek Jendrzej
2021-11-06 20:34:39 +01:00
committed by vanhofen
parent 4a525fbb8a
commit 4150a3cd54

View File

@@ -157,7 +157,10 @@ void CComponentsButton::initIcon()
int y_icon = height/2 - h_icon/2;
//init icon object
if (cc_btn_icon_obj == NULL){
if(!cc_btn_icon.empty())
{
if (cc_btn_icon_obj == NULL)
{
cc_btn_icon_obj = new CComponentsPicture(fr_thickness, y_icon, cc_btn_icon, this);
cc_btn_icon_obj->SetTransparent(CFrameBuffer::TM_BLACK);
cc_btn_icon_obj->doPaintBg(false);
@@ -165,6 +168,7 @@ void CComponentsButton::initIcon()
cc_btn_icon_obj->setHeight(h_icon, true);
cc_btn_icon_obj->setPicture(cc_btn_icon);
}
}
void CComponentsButton::initCaption()
{