Mercurial > hg > openttd
changeset 9138:68a2c2bc8580 draft
(svn r12999) -Fix [FS#1995]: when a Window got deleted on a double click event, we should not send a click event to the now non-existant Window as that causes segfaults.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 07 May 2008 21:45:27 +0000 |
parents | 68ef8b14efaf |
children | f327ed4393ee |
files | src/window.cpp |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/window.cpp +++ b/src/window.cpp @@ -1931,9 +1931,14 @@ } } else { switch (click) { - case MC_DOUBLE_LEFT: DispatchLeftClickEvent(w, x - w->left, y - w->top, true); - /* fallthough, and also give a single-click for backwards compatible */ - case MC_LEFT: DispatchLeftClickEvent(w, x - w->left, y - w->top, false); break; + case MC_DOUBLE_LEFT: + DispatchLeftClickEvent(w, x - w->left, y - w->top, true); + if (_mouseover_last_w == NULL) break; // The window got removed. + /* fallthough, and also give a single-click for backwards compatibility */ + case MC_LEFT: + DispatchLeftClickEvent(w, x - w->left, y - w->top, false); + break; + default: if (!scrollwheel_scrolling || w == NULL || w->window_class != WC_SMALLMAP) break; /* We try to use the scrollwheel to scroll since we didn't touch any of the buttons.