Prevent non-freed memory

This commit is contained in:
Lorenzooone
2024-04-19 16:59:29 +02:00
parent 2149188c33
commit 0982853ee4
2 changed files with 9 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ std::string save_screen_info(std::string base, const ScreenInfo &info);
class TextRectangle {
public:
TextRectangle(bool font_load_success, sf::Font &text_font);
~TextRectangle();
enum TextRectangleKind {TEXT_NORMAL, TEXT_SELECTED, TEXT_SUCCESS, TEXT_WARNING, TEXT_ERROR};
void setSize(int width, int height);
void setRectangleKind(TextRectangleKind kind);

View File

@@ -19,6 +19,14 @@ TextRectangle::TextRectangle(bool font_load_success, sf::Font &text_font) {
this->reset_data(this->future_data);
}
TextRectangle::~TextRectangle() {
delete this->base_bg_color;
delete this->selected_bg_color;
delete this->success_bg_color;
delete this->warning_bg_color;
delete this->error_bg_color;
}
void TextRectangle::setSize(int width, int height) {
this->width = width;
this->height = height;