fix: free Traintastic object before creating a new one on restart

caused socket bind issues
Dieser Commit ist enthalten in:
Reinder Feenstra 2022-05-31 23:09:22 +02:00
Ursprung 39d180a2fd
Commit ae33e80d8d

Datei anzeigen

@ -203,6 +203,18 @@ int main(int argc, char* argv[])
if(options.tray)
Windows::TrayIcon::remove();
#endif
if(Traintastic::instance)
{
#ifndef NDEBUG
std::weak_ptr<Traintastic> weak = Traintastic::instance;
#endif
Traintastic::instance->destroy(); // notify others to release the object
Traintastic::instance.reset();
#ifndef NDEBUG
assert(weak.expired());
#endif
}
}
while(restart);