remove pointer and using update() should fix random crash (thanks Uknown)

This commit is contained in:
Ade Novan 2016-10-31 22:22:57 +08:00 committed by Gde Made Novan Priambhada
parent 1241d53a8a
commit 6121dce9e1
6 changed files with 32 additions and 35 deletions

View file

@ -69,7 +69,8 @@ void ChatMenu::CreateViews() {
CreatePopupContents(box_);
root_->SetDefaultFocusView(box_);
UpdateChat();
g_Config.iNewChat = 0;
chatScreenVisible = true;
newChat = 0;
}
void ChatMenu::dialogFinished(const Screen *dialog, DialogResult result) {
@ -142,6 +143,7 @@ void ChatMenu::UpdateChat() {
}
}
toBottom_ = true;
updateChatScreen = false;
}
}
@ -157,6 +159,13 @@ bool ChatMenu::touch(const TouchInput &touch) {
return UIDialogScreen::touch(touch);
}
void ChatMenu::update(InputState &input) {
PopupScreen::update(input);
if (updateChatScreen) {
UpdateChat();
}
}
void ChatMenu::postRender() {
if (scroll_ && toBottom_) {
scroll_->ScrollToBottom();
@ -165,7 +174,5 @@ void ChatMenu::postRender() {
}
ChatMenu::~ChatMenu() {
setChatPointer(NULL);
scroll_ = NULL;
chatVert_ = NULL;
chatScreenVisible = false;
}