diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-05-09 00:32:18 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-05-09 00:33:12 -0600 |
commit | 3074acf977841492b2378b5542bc3d755cf0a227 (patch) | |
tree | c925bea4d6d401f7ebeb03685f901f7adb9d24e2 | |
parent | 2c409c2226f848c39fa0d371b56855d011c682db (diff) | |
download | mana-3074acf977841492b2378b5542bc3d755cf0a227.tar.gz mana-3074acf977841492b2378b5542bc3d755cf0a227.tar.bz2 mana-3074acf977841492b2378b5542bc3d755cf0a227.tar.xz mana-3074acf977841492b2378b5542bc3d755cf0a227.zip |
Fix some memory leaks
In doing so, NPC Dialogs now show the resize grip again.
-rw-r--r-- | src/gui/npcdialog.cpp | 12 | ||||
-rw-r--r-- | src/gui/npcdialog.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 7 |
4 files changed, 19 insertions, 3 deletions
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 64101c0c..57c736d0 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -110,6 +110,16 @@ NpcDialog::NpcDialog() loadWindowState(); } +NpcDialog::~NpcDialog() +{ + // These might not actually be in the layout, so lets be safe + delete mItemList; + delete mTextField; + delete mIntField; + delete mResetButton; + delete mPlusButton; + delete mMinusButton; +} void NpcDialog::setText(const std::string &text) { @@ -282,6 +292,8 @@ void NpcDialog::buildLayout() { clearLayout(); + add(mGrip); + if (mActionState != NPC_ACTION_INPUT) { if (mActionState == NPC_ACTION_WAIT) diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h index 7800d828..bd738e81 100644 --- a/src/gui/npcdialog.h +++ b/src/gui/npcdialog.h @@ -54,6 +54,8 @@ class NpcDialog : public Window, public gcn::ActionListener, */ NpcDialog(); + ~NpcDialog(); + /** * Called when receiving actions from the widgets. */ diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 87051686..a34b7612 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -22,7 +22,6 @@ #include "gui/widgets/window.h" #include "gui/widgets/layout.h" -#include "gui/widgets/resizegrip.h" #include "gui/widgets/windowcontainer.h" #include "gui/gui.h" diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 11193654..563e2f2f 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -25,6 +25,8 @@ #include "graphics.h" #include "guichanfwd.h" +#include "gui/widgets/resizegrip.h" + #include <guichan/widgetlistener.hpp> #include <guichan/widgets/window.hpp> @@ -32,7 +34,6 @@ class ContainerPlacer; class Layout; class LayoutCell; -class ResizeGrip; class Skin; class WindowContainer; @@ -336,6 +337,9 @@ class Window : public gcn::Window, gcn::WidgetListener */ int getGuiAlpha(); + protected: + ResizeGrip *mGrip; /**< Resize grip */ + private: enum ResizeHandles { @@ -354,7 +358,6 @@ class Window : public gcn::Window, gcn::WidgetListener */ int getResizeHandles(gcn::MouseEvent &event); - ResizeGrip *mGrip; /**< Resize grip */ Window *mParent; /**< The parent window */ Layout *mLayout; /**< Layout handler */ std::string mWindowName; /**< Name of the window */ |