QmlDesigner: Reset puppet alive timer when connection is cleared

It is simpler to just recreate the timer than reuse the existing one.

Change-Id: I50a8507a69b83917ff522bb5ae472285135c351c
Fixes: QDS-3026
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-12-03 16:46:19 +02:00
parent 7a85771c20
commit 98af1e5033
2 changed files with 4 additions and 3 deletions

View File

@@ -38,7 +38,6 @@ ConnectionManagerInterface::Connection::~Connection() = default;
ConnectionManagerInterface::Connection::Connection(const QString &name, const QString &mode)
: name{name}
, mode{mode}
, timer{std::make_unique<QTimer>()}
{}
ConnectionManagerInterface::Connection::Connection(Connection &&connection) = default;
@@ -49,7 +48,7 @@ void ConnectionManagerInterface::Connection::clear()
socket.reset();
blockSize = 0;
lastReadCommandCounter = 0;
timer->stop();
timer.reset();
}
} // namespace QmlDesigner

View File

@@ -52,8 +52,10 @@ void InteractiveConnectionManager::setUp(NodeInstanceServerInterface *nodeInstan
DesignerSettings settings = QmlDesignerPlugin::instance()->settings();
int timeOutTime = settings.value(DesignerSettingsKey::PUPPET_KILL_TIMEOUT).toInt();
for (Connection &connection : connections())
for (Connection &connection : connections()) {
connection.timer.reset(new QTimer);
connection.timer->setInterval(timeOutTime);
}
if (QmlDesignerPlugin::instance()
->settings()