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

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-02-03 13:21:54 +01:00
parent bf8cb8305e
commit 1d525911f1
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -189,16 +189,8 @@ private:
SharePtr _placeholderLinkShare; SharePtr _placeholderLinkShare;
SharePtr _internalLinkShare; SharePtr _internalLinkShare;
// DO NOT USE QSHAREDPOINTERS HERE. QPointer<AccountState> _accountState;
// QSharedPointers MUST NOT be used with pointers already assigned to other shared pointers. QPointer<Folder> _folder;
// 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;
QString _localPath; QString _localPath;
QString _sharePath; QString _sharePath;