Emit last to avoid use after delete crash
authorKevin Ottens <kevin.ottens@nextcloud.com>
Wed, 14 Oct 2020 16:35:12 +0000 (18:35 +0200)
committerCamila (Rebase PR Action) <hello@camila.codes>
Mon, 19 Oct 2020 14:33:19 +0000 (14:33 +0000)
It turns out the shareDeleted() signal is connected to a function
cleaning up the ShareLinkWidget holding the last shared pointer to the
Share object. Since we use member variables for calling updateFolder()
this would lead to using deleted objects.

Just swap the call and the signal to have everything back in order.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/gui/sharemanager.cpp

index 2b8fbd4a98c5991f951900d62967eaba872f57bd..87df91350aa4c3c57ad77a8128f9597261f9f140 100644 (file)
@@ -133,9 +133,8 @@ void Share::deleteShare()
 
 void Share::slotDeleted()
 {
-    emit shareDeleted();
-
     updateFolder(_account, _path);
+    emit shareDeleted();
 }
 
 void Share::slotOcsError(int statusCode, const QString &message)