ocarina: Free strings created by g_markup_escape_text()
This function returns a newly allocated string, so I can't set it directly to a C++ string since this will leak memory. Instead, I need to keep the char* pointer around to free it. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
dce461656f
commit
cefbf36415
|
@ -16,9 +16,10 @@ static list<NowPlayingWidgets> nowplaying_widgets;
|
|||
|
||||
static void set_label(GtkWidget *label, string text, string size)
|
||||
{
|
||||
string escaped = g_markup_escape_text(text.c_str(), -1);
|
||||
char *escaped = g_markup_escape_text(text.c_str(), -1);
|
||||
string markup = "<span size='" + size + "'>" + escaped + "</span>";
|
||||
gtk_label_set_markup(GTK_LABEL(label), markup.c_str());
|
||||
g_free(escaped);
|
||||
}
|
||||
|
||||
static void set_now_playing(struct NowPlayingWidgets *widgets, string title,
|
||||
|
|
Loading…
Reference in New Issue