mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r13082) -Fix (r13042): segmentation fault due to too early deletion of OskWindow.
This commit is contained in:
parent
b4682bff97
commit
c9f26cceb7
@ -129,6 +129,8 @@ struct OskWindow : public Window {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool delete_this = false;
|
||||||
|
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case OSK_WIDGET_BACKSPACE:
|
case OSK_WIDGET_BACKSPACE:
|
||||||
if (DeleteTextBufferChar(&this->qs->text, WKC_BACKSPACE)) this->InvalidateWidget(OSK_WIDGET_TEXT);
|
if (DeleteTextBufferChar(&this->qs->text, WKC_BACKSPACE)) this->InvalidateWidget(OSK_WIDGET_TEXT);
|
||||||
@ -171,7 +173,7 @@ struct OskWindow : public Window {
|
|||||||
this->parent->OnClick(pt, this->ok_btn);
|
this->parent->OnClick(pt, this->ok_btn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete this;
|
delete_this = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OSK_WIDGET_CANCEL:
|
case OSK_WIDGET_CANCEL:
|
||||||
@ -182,12 +184,13 @@ struct OskWindow : public Window {
|
|||||||
strcpy(qs->text.buf, this->orig_str_buf);
|
strcpy(qs->text.buf, this->orig_str_buf);
|
||||||
UpdateTextBufferSize(&qs->text);
|
UpdateTextBufferSize(&qs->text);
|
||||||
MoveTextBufferPos(&qs->text, WKC_END);
|
MoveTextBufferPos(&qs->text, WKC_END);
|
||||||
delete this;
|
delete_this = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* make sure that the parent window's textbox also gets updated */
|
/* make sure that the parent window's textbox also gets updated */
|
||||||
if (this->parent != NULL) this->parent->InvalidateWidget(this->text_btn);
|
if (this->parent != NULL) this->parent->InvalidateWidget(this->text_btn);
|
||||||
|
if (delete_this) delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnMouseLoop()
|
virtual void OnMouseLoop()
|
||||||
|
Loading…
Reference in New Issue
Block a user