summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-12-17 05:53:34 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-12-17 05:58:09 +0100
commit09aded2bc8b447915511b26ebe71eab6ec98585a (patch)
tree5e99c631f9c6f5b7d37a8fec1fb61f58b4b141b6 /src/main.cpp
parent88521caf0de7d08a951a7fdff2becdbf5ec391c9 (diff)
Fix crash when receiving matrix uri
It seems like handling the message in a blocking manner is a no-go. I have no idea how to fix that, so just use a queued connection for now... (ASAN does not cooperate and just hides the crash D:) fixes #842
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b9134317..5a2cb413 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -277,22 +277,28 @@ main(int argc, char *argv[])
w.activateWindow();
});
+ // It seems like handling the message in a blocking manner is a no-go. I have no idea how to
+ // fix that, so just use a queued connection for now... (ASAN does not cooperate and just
+ // hides the crash D:)
QObject::connect(
&app,
&SingleApplication::receivedMessage,
ChatPage::instance(),
- [&](quint32, QByteArray message) { ChatPage::instance()->handleMatrixUri(message); });
+ [&](quint32, QByteArray message) {
+ QString m = QString::fromUtf8(message);
+ ChatPage::instance()->handleMatrixUri(m);
+ },
+ Qt::QueuedConnection);
QMetaObject::Connection uriConnection;
if (app.isPrimary() && !matrixUri.isEmpty()) {
- uriConnection =
- QObject::connect(ChatPage::instance(),
- &ChatPage::contentLoaded,
- ChatPage::instance(),
- [&uriConnection, matrixUri]() {
- ChatPage::instance()->handleMatrixUri(matrixUri.toUtf8());
- QObject::disconnect(uriConnection);
- });
+ uriConnection = QObject::connect(ChatPage::instance(),
+ &ChatPage::contentLoaded,
+ ChatPage::instance(),
+ [&uriConnection, matrixUri]() {
+ ChatPage::instance()->handleMatrixUri(matrixUri);
+ QObject::disconnect(uriConnection);
+ });
}
QDesktopServices::setUrlHandler("matrix", ChatPage::instance(), "handleMatrixUri");