aboutsummaryrefslogtreecommitdiff
path: root/src/guiFormSpecMenu.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-04-20 02:40:25 +0200
committersapier <Sapier at GMX dot net>2014-04-22 20:59:01 +0200
commit127f354e7a5e85cfc46304499e7c8619fc9538c8 (patch)
tree61f77a04d87f8b81a072a7e1f3b68003142f331f /src/guiFormSpecMenu.cpp
parente7ef4f07cb19aeed768c9010ac49cf5801541ded (diff)
downloadminetest-127f354e7a5e85cfc46304499e7c8619fc9538c8.tar.gz
minetest-127f354e7a5e85cfc46304499e7c8619fc9538c8.tar.bz2
minetest-127f354e7a5e85cfc46304499e7c8619fc9538c8.zip
Fix formspec replacement handling for in game formspecs
Diffstat (limited to 'src/guiFormSpecMenu.cpp')
-rw-r--r--src/guiFormSpecMenu.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index 881b4c5fc..962d15188 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -68,20 +68,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
gui::IGUIElement* parent, s32 id, IMenuManager *menumgr,
InventoryManager *invmgr, IGameDef *gamedef,
- ISimpleTextureSource *tsrc) :
+ ISimpleTextureSource *tsrc, IFormSource* fsrc, TextDest* tdst,
+ GUIFormSpecMenu** ext_ptr) :
GUIModalMenu(dev->getGUIEnvironment(), parent, id, menumgr),
m_device(dev),
m_invmgr(invmgr),
m_gamedef(gamedef),
m_tsrc(tsrc),
- m_form_src(NULL),
- m_text_dst(NULL),
m_selected_item(NULL),
m_selected_amount(0),
m_selected_dragging(false),
m_tooltip_element(NULL),
m_allowclose(true),
- m_lock(false)
+ m_lock(false),
+ m_form_src(fsrc),
+ m_text_dst(tdst),
+ m_ext_ptr(ext_ptr)
{
current_keys_pending.key_down = false;
current_keys_pending.key_up = false;
@@ -95,8 +97,18 @@ GUIFormSpecMenu::~GUIFormSpecMenu()
removeChildren();
delete m_selected_item;
- delete m_form_src;
- delete m_text_dst;
+
+ if (m_form_src != NULL) {
+ delete m_form_src;
+ }
+ if (m_text_dst != NULL) {
+ delete m_text_dst;
+ }
+
+ if (m_ext_ptr != NULL) {
+ assert(*m_ext_ptr == this);
+ *m_ext_ptr = NULL;
+ }
}
void GUIFormSpecMenu::removeChildren()