]> Some of my projects - aniplayer.git/commitdiff
Don't delete TimeFormatter immediately
authorAPTX <marek321@gmail.com>
Wed, 1 Mar 2017 15:01:12 +0000 (16:01 +0100)
committerAPTX <marek321@gmail.com>
Wed, 1 Mar 2017 15:01:12 +0000 (16:01 +0100)
It will is deleted implicitly as a child of
InstanceManager.

core/instancemanager.cpp

index fca0c20c6a1d92f0ab7809ee3b8d125a4f137750..43eb2365b85aade5e0784c866be77edb8f9ba4bf 100644 (file)
@@ -43,9 +43,9 @@ void InstanceManager::startFirstInstance() {
     qCDebug(imCategory) << "Parsed positional argument as" << url;
     player->setNextSource(url);
   }
-  TimeFormatter timeFormatter;
+  auto timeFormatter = new TimeFormatter{this};
   engine->rootContext()->setContextProperty("player", player);
-  engine->rootContext()->setContextProperty("timeFormatter", &timeFormatter);
+  engine->rootContext()->setContextProperty("timeFormatter", timeFormatter);
   qCDebug(imCategory, "Player Added");
   engine->load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
   qCDebug(imCategory, "QML engine loaded");