summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-16 12:30:52 +0000
committerdarkvater <darkvater@openttd.org>2005-01-16 12:30:52 +0000
commit8efc7866dd577091b4cde55cecf03c1af5c9c22a (patch)
tree6552dbb107388fa685514f3bc2c79adbfe8233dd
parent37f56fa324fbd175f3804ab817ca728461c0a491 (diff)
downloadopenttd-8efc7866dd577091b4cde55cecf03c1af5c9c22a.tar.xz
(svn r1539) -Fix: [1103271] free'd memory used. Moved w->wndproc(w, &e) to end of function. Thanks for finding this tamlin.
-rw-r--r--window.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/window.c b/window.c
index 8e55c1c87..ae46c4ba3 100644
--- a/window.c
+++ b/window.c
@@ -48,31 +48,27 @@ void DispatchLeftClickEvent(Window *w, int x, int y) {
ScrollbarClickHandler(w, wi, e.click.pt.x, e.click.pt.y);
}
- w->wndproc(w, &e);
-
if (w->desc_flags & WDF_STD_BTN) {
- if (e.click.widget == 0) {
+ if (e.click.widget == 0) { /* 'X' */
DeleteWindow(w);
return;
- } else {
- if (e.click.widget == 1) {
- StartWindowDrag(w);
- }
- }
+ }
+
+ if (e.click.widget == 1) /* 'Title bar' */
+ StartWindowDrag(w);
}
- if (w->desc_flags & WDF_RESIZABLE && wi->type == WWT_RESIZEBOX) {
+ if (w->desc_flags & WDF_RESIZABLE && wi->type == WWT_RESIZEBOX)
StartWindowSizing(w);
- }
if (w->desc_flags & WDF_STICKY_BUTTON && wi->type == WWT_STICKYBOX) {
- w->click_state ^= (1 << e.click.widget);
+ TOGGLEBIT(w->click_state, e.click.widget);
w->flags4 ^= WF_STICKY;
InvalidateWidget(w, e.click.widget);
}
- } else {
- w->wndproc(w, &e);
}
+
+ w->wndproc(w, &e);
}
void DispatchRightClickEvent(Window *w, int x, int y) {
@@ -771,14 +767,14 @@ static bool HandlePopupMenu()
if (_left_button_down) {
e.event = WE_POPUPMENU_OVER;
e.popupmenu.pt = _cursor.pos;
- w->wndproc(w, &e);
} else {
_popup_menu_active = false;
e.event = WE_POPUPMENU_SELECT;
e.popupmenu.pt = _cursor.pos;
- w->wndproc(w, &e);
}
+ w->wndproc(w, &e);
+
return false;
}