src/window.cpp
changeset 10426 4a77f7049b5e
parent 10238 5076964d81a1
child 10438 51bff16a04c9
--- a/src/window.cpp	Mon Dec 15 22:22:23 2008 +0000
+++ b/src/window.cpp	Tue Dec 16 17:58:27 2008 +0000
@@ -461,7 +461,13 @@
 	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 @@
 		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;