From 4c9590e65dcbd78e3d4569c353e0ce55abe8e27c Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sun, 21 Feb 2010 08:02:06 +0000 Subject: [PATCH] Make a copy of the passed argument (will otherwise give undef references) --- Src/gui/status_bar.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Src/gui/status_bar.cpp b/Src/gui/status_bar.cpp index 552442f..837aa5b 100644 --- a/Src/gui/status_bar.cpp +++ b/Src/gui/status_bar.cpp @@ -1,5 +1,6 @@ #include "status_bar.hh" #include "gui.hh" +#include "utils.hh" StatusBar::StatusBar() : Menu(Gui::gui->small_font), TimeoutHandler() { @@ -12,7 +13,7 @@ StatusBar::StatusBar() : Menu(Gui::gui->small_font), TimeoutHandler() void StatusBar::queueMessage(const char *message) { - this->messages[this->head] = message; + this->messages[this->head] = xstrdup(message); /* If this is the first message, display it as soon as possible */ if (this->head == this->tail) @@ -49,6 +50,7 @@ void StatusBar::timeoutCallback() } else this->setText(NULL); + free((void *)this->cur_message); } void StatusBar::draw(SDL_Surface *where)