bugfix: added keepalive, to make sure object isn't deleted during destroy() call

Dieser Commit ist enthalten in:
Reinder Feenstra 2023-01-06 00:50:32 +01:00
Ursprung 74ac77b1a1
Commit 896bd2a13f

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2019-2021 Reinder Feenstra
* Copyright (C) 2019-2021,2023 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -41,6 +41,7 @@ void Object::destroy()
if(!m_dying)
{
m_dying = true;
auto keepAlive = shared_from_this(); // make sure object isn't deleted during destroying
destroying();
onDestroying(*this);
}