TouchScreenGUI: fix rare crash

master
Maksim 2022-05-12 19:11:25 +03:00
parent b23c5b02ba
commit 941fcdd97e
2 changed files with 8 additions and 2 deletions

View File

@ -2,7 +2,7 @@
Copyright (C) 2014 sapier
Copyright (C) 2018 srifqi, Muhammad Rifqi Priyo Susanto
<muhammadrifqipriyosusanto@gmail.com>
Copyright (C) 2014-2020 Maksim Gamarnik [MoNTE48] MoNTE48@mail.ua
Copyright (C) 2014-2022 Maksim Gamarnik [MoNTE48] Maksym48@pm.me
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -632,6 +632,8 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc)
m_screensize.X,
button_size),
L"Chat", false);
m_buttons_initialized = true;
}
touch_gui_button_id TouchScreenGUI::getButtonID(s32 x, s32 y)
@ -1146,6 +1148,9 @@ TouchScreenGUI::~TouchScreenGUI()
}
}
if (!m_buttons_initialized)
return;
if (m_joystick_btn_off->guibutton) {
m_joystick_btn_off->guibutton->drop();
m_joystick_btn_off->guibutton = nullptr;

View File

@ -1,6 +1,6 @@
/*
Copyright (C) 2014 sapier
Copyright (C) 2014-2020 Maksim Gamarnik [MoNTE48] MoNTE48@mail.ua
Copyright (C) 2014-2022 Maksim Gamarnik [MoNTE48] Maksym48@pm.me
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -215,6 +215,7 @@ private:
std::map<int, rect<s32>> m_hud_rects;
std::map<size_t, irr::EKEY_CODE> m_hud_ids;
bool m_visible; // is the gui visible
bool m_buttons_initialized = false;
// value in degree
double m_camera_yaw_change = 0.0;