Delay Overlays cleanup for scripting

This commit is contained in:
Zach Pomerantz 2016-05-09 17:28:27 -07:00
parent a0d80b9508
commit 694dc1bbf6
3 changed files with 7 additions and 11 deletions

View file

@ -1189,6 +1189,9 @@ void Application::cleanupBeforeQuit() {
DependencyManager::get<ScriptEngines>()->shutdownScripting(); // stop all currently running global scripts
DependencyManager::destroy<ScriptEngines>();
// Cleanup all overlays after the scripts, as scripts might add more
_overlays.cleanupAllOverlays();
// first stop all timers directly or by invokeMethod
// depending on what thread they run in
locationUpdateTimer.stop();

View file

@ -36,15 +36,8 @@
#include <QtQuick/QQuickWindow>
Overlays::Overlays() : _nextOverlayID(1) {
connect(qApp, &Application::beforeAboutToQuit, [=] {
cleanupAllOverlays();
});
}
Overlays::~Overlays() {
}
Overlays::Overlays() :
_nextOverlayID(1) {}
void Overlays::cleanupAllOverlays() {
{

View file

@ -62,7 +62,6 @@ class Overlays : public QObject {
public:
Overlays();
~Overlays();
void init();
void update(float deltatime);
@ -73,6 +72,8 @@ public:
Overlay::Pointer getOverlay(unsigned int id) const;
OverlayPanel::Pointer getPanel(unsigned int id) const { return _panels[id]; }
void cleanupAllOverlays();
public slots:
/// adds an overlay with the specific properties
unsigned int addOverlay(const QString& type, const QVariant& properties);
@ -145,7 +146,6 @@ signals:
private:
void cleanupOverlaysToDelete();
void cleanupAllOverlays();
QMap<unsigned int, Overlay::Pointer> _overlaysHUD;
QMap<unsigned int, Overlay::Pointer> _overlaysWorld;