summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/window.cpp b/src/window.cpp
index f12cd573f..f28d4dbdd 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -461,7 +461,13 @@ Window::~Window()
if (this->viewport != NULL) DeleteWindowViewport(this);
this->SetDirty();
- free(this->widget);
+
+ if (this->widget != NULL) {
+ for (const Widget *wi = this->widget; wi->type != WWT_LAST; wi++) {
+ if (wi->type == WWT_EDITBOX) _no_scroll--;
+ }
+ free(this->widget);
+ }
}
/**
@@ -690,6 +696,10 @@ static void AssignWidgetToWindow(Window *w, const Widget *widget)
w->widget = MallocT<Widget>(index);
memcpy(w->widget, widget, sizeof(*w->widget) * index);
w->widget_count = index - 1;
+
+ for (const Widget *wi = w->widget; wi->type != WWT_LAST; wi++) {
+ if (wi->type == WWT_EDITBOX) _no_scroll++;
+ }
} else {
w->widget = NULL;
w->widget_count = 0;