Explorar o código

Make ShareModel's accountState and folder pointers QPointers to guard against crashes

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
Claudio Cambra %!s(int64=3) %!d(string=hai) anos
pai
achega
1d525911f1
Modificáronse 1 ficheiros con 2 adicións e 10 borrados
  1. 2 10
      src/gui/filedetails/sharemodel.h

+ 2 - 10
src/gui/filedetails/sharemodel.h

@@ -189,16 +189,8 @@ private:
     SharePtr _placeholderLinkShare;
     SharePtr _internalLinkShare;
 
-    // DO NOT USE QSHAREDPOINTERS HERE.
-    // QSharedPointers MUST NOT be used with pointers already assigned to other shared pointers.
-    // This is because they do not share reference counters, and as such are not aware of another
-    // smart pointer's use of the same object.
-    //
-    // We cannot pass objects instantiated in QML using smart pointers through the property interface
-    // so we have to pass the pointer here. If we kill the dialog using a smart pointer then
-    // these objects will be deallocated for the entire application. We do not want that!!
-    AccountState *_accountState = nullptr;
-    Folder *_folder = nullptr;
+    QPointer<AccountState> _accountState;
+    QPointer<Folder> _folder;
 
     QString _localPath;
     QString _sharePath;