Merge PR #760: Fix crash when syncing remote connection configs via a remote connection
This commit is contained in:
commit
6ee4a2e007
@ -41,6 +41,10 @@ ServerConfiguration::ServerConfiguration(const QString &id, const QString &addre
|
||||
|
||||
}
|
||||
|
||||
ServerConfiguration::~ServerConfiguration()
|
||||
{
|
||||
}
|
||||
|
||||
QString ServerConfiguration::id() const
|
||||
{
|
||||
return m_id;
|
||||
|
||||
@ -46,6 +46,7 @@ class ServerConfiguration : public QObject
|
||||
|
||||
public:
|
||||
explicit ServerConfiguration(const QString &id, const QString &address = QString(), int port = 0, bool authEnabled = false, bool sslEnabled = false, QObject *parent = nullptr);
|
||||
virtual ~ServerConfiguration();
|
||||
|
||||
QString id() const;
|
||||
|
||||
|
||||
@ -101,21 +101,6 @@ bool NymeaHost::online() const
|
||||
return m_online;
|
||||
}
|
||||
|
||||
void NymeaHost::addTunnelConnection()
|
||||
{
|
||||
for (int i = 0; i < m_connections->rowCount(); i++) {
|
||||
if (m_connections->get(i)->url().scheme() == "tunnel") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
QUrl url;
|
||||
url.setScheme("tunnel");
|
||||
url.setHost(m_uuid.toString().remove(QRegExp("[{}]")));
|
||||
qCritical() << "Adding tunnel connection" << url << m_uuid;
|
||||
Connection *connection = new Connection(url, Connection::BearerTypeCloud, true, "foooobaaaar", this);
|
||||
m_connections->addConnection(connection);
|
||||
}
|
||||
|
||||
void NymeaHost::syncOnlineState()
|
||||
{
|
||||
for (int i = 0; i < m_connections->rowCount(); i++) {
|
||||
|
||||
@ -158,8 +158,6 @@ public:
|
||||
|
||||
bool online() const;
|
||||
|
||||
Q_INVOKABLE void addTunnelConnection();
|
||||
|
||||
signals:
|
||||
void nameChanged();
|
||||
void versionChanged();
|
||||
|
||||
@ -352,6 +352,13 @@ Item {
|
||||
}
|
||||
|
||||
function syncRemoteConnection() {
|
||||
if (engine.jsonRpcClient.currentConnection.url.toString().startsWith("tunnel")) {
|
||||
// Not resyncing tunnel configurations while we're connected through a tunnel ourselves
|
||||
// (We could, maybe even should, but currently libnymea-app borrows the "NymeaHost" pointer from
|
||||
// the hostsmodel and will crash if we delete the used Connection object)
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < engine.jsonRpcClient.currentHost.connections.count; i++) {
|
||||
var connection = engine.jsonRpcClient.currentHost.connections.get(i)
|
||||
if (connection.url.toString().startsWith("tunnel")) {
|
||||
|
||||
Reference in New Issue
Block a user