CComponentsText: fix possible segfault

segfault happens on left empty text

CComponentsInfoBox: inherit ct_textbox

CComponentsInfoBox: inherit ct_box

CComponentsInfoBox: inherit ct_box
This commit is contained in:
2012-10-23 21:25:20 +02:00
parent bb39d1f64f
commit d970c5303f
2 changed files with 53 additions and 42 deletions

View File

@@ -218,17 +218,19 @@ class CComponentsPicture : public CComponentsItem
class CComponentsText : public CComponentsItem
{
private:
Font* ct_font;
CBox * ct_box;
CTextBox * ct_textbox;
protected:
CTextBox * ct_textbox;
CBox * ct_box;
Font * ct_font;
void initVarText();
private:
const char* ct_text;
int ct_text_mode; //see textbox.h for possible modes
fb_pixel_t ct_col_text;
bool ct_text_sended;
void initVarText();
void initText();
public:
@@ -249,9 +251,7 @@ class CComponentsInfoBox : public CComponentsText
const char* text;
int text_mode; //see textbox.h for possible modes
int x_text, x_offset;
Font* font;
CBox * box;
CTextBox * textbox;
CComponentsPicture * pic;
std::string pic_default_name;
@@ -269,11 +269,11 @@ class CComponentsInfoBox : public CComponentsText
~CComponentsInfoBox();
inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;};
inline void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;};
inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, ct_font = font_text;};
inline void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, ct_font = font_text;};
void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL);
inline void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes
inline void setTextFont(Font* font_text){font = font_text;};
inline void setTextFont(Font* font_text){ct_font = font_text;};
inline void setTextColor(fb_pixel_t color_text){ ibox_col_text = color_text;};
inline void setSpaceOffset(const int offset){x_offset = offset;};
inline void setPicture(const std::string& picture_name){pic_name = picture_name;};