diff --git a/src/text.cpp b/src/text.cpp index 9e44f9fefbb48..4bc72b8c8c9de 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -23,9 +23,11 @@ Segment::Segment( const std::string_view( sv ), nc_color c ) , color( u32_from_color( c ) ) {} -Paragraph *parse_colored_text( const std::string_view str, nc_color default_color ) +std::shared_ptr parse_colored_text( const std::string_view str, nc_color default_color ) { - return ( new cataimgui::Paragraph() )->append_colored_text( str, default_color ); + std::shared_ptr p = std::make_shared(); + p->append_colored_text( str, default_color ); + return p; } Paragraph::Paragraph( ) diff --git a/src/text.h b/src/text.h index 3c715becbebd2..7d9fcf3087939 100644 --- a/src/text.h +++ b/src/text.h @@ -60,7 +60,7 @@ struct Paragraph { Paragraph *separated(); }; -Paragraph *parse_colored_text( std::string_view str, nc_color default_color ); +std::shared_ptr parse_colored_text( std::string_view str, nc_color default_color ); void TextStyled( std::shared_ptr para, float wrap_width = 0.0f ); void TextUnstyled( std::shared_ptr para, float wrap_width = 0.0f ); void TextParagraph( nc_color color, std::string_view para, float wrap_width = 0.0f );