Move to more memory safe implementation of widget holding

This commit is contained in:
2025-12-12 15:35:32 +02:00
parent ddc7898a78
commit 8e276ab2ab
6 changed files with 16 additions and 17 deletions

View File

@@ -262,7 +262,7 @@ void WidgetText::draw()
SDL_FreeSurface(txt_surface);
}
Widget* WidgetText::builder(const nlohmann::json& j)
std::unique_ptr<Widget> WidgetText::builder(const nlohmann::json& j)
{
int x = 0;
int y = 0;
@@ -299,7 +299,7 @@ Widget* WidgetText::builder(const nlohmann::json& j)
return nullptr;
}
return new WidgetText(x, y, width, height,
return std::make_unique<WidgetText>(x, y, width, height,
text, fit, should_wrap,
halign, valign,
halign_via_visible, valign_via_visible,