diff options
author | smatz <smatz@openttd.org> | 2008-09-16 19:05:38 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-09-16 19:05:38 +0000 |
commit | 5a1203963fc50139bfe4d7cab27fa32d1d6fc9dc (patch) | |
tree | ad34d1c34ba491ff9a432b22a6c686dcd3d6b3e9 /src/signs_gui.cpp | |
parent | 4a97033e7e2cbc8e028d974b1eaeee1114cc8fd6 (diff) | |
download | openttd-5a1203963fc50139bfe4d7cab27fa32d1d6fc9dc.tar.xz |
(svn r14345) -Fix: delete the RenameSignWindow when 'its' sign is deleted
Also, it makes sure the RenameSignWindow isn't open when there are no signs (and crashes associted with that)
Diffstat (limited to 'src/signs_gui.cpp')
-rw-r--r-- | src/signs_gui.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index ec89f5ebc..8b319a721 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -286,8 +286,9 @@ struct SignWindow : QueryStringBaseWindow, SignList { case QUERY_EDIT_SIGN_WIDGET_DELETE: /* Only need to set the buffer to null, the rest is handled as the OK button */ - DeleteTextBufferAll(&this->text); - /* FALL THROUGH */ + RenameSign(this->cur_sign, ""); + /* don't delete this, we are deleted in Sign::~Sign() -> DeleteRenameSignWindow() */ + break; case QUERY_EDIT_SIGN_WIDGET_OK: RenameSign(this->cur_sign, this->text.buf); @@ -358,3 +359,10 @@ void ShowRenameSignWindow(const Sign *si) new SignWindow(&_query_sign_edit_desc, si); } + +void DeleteRenameSignWindow(SignID sign) +{ + SignWindow *w = dynamic_cast<SignWindow *>(FindWindowById(WC_QUERY_STRING, 0)); + + if (w != NULL && w->cur_sign == sign) delete w; +} |