D23070: Remove usage of QWeakPointer for QObject for thumbnails
Frederik Gladhorn <[email protected]>
| Newsgroups | gmane.comp.kde.devel.kwin |
|---|---|
| Message-ID | <[email protected]> |
gladhorn added a comment. In D23070#509771 <https://phabricator.kde.org/D23070#509771>, @romangg wrote: > In D23070#509761 <https://phabricator.kde.org/D23070#509761>, @gladhorn wrote: > > > See https://phabricator.kde.org/D23065 > > > > Using a QWeakPointer for QObjects works, but has been deprecated for around seven years. QPointer does the same cleanly (track life-time of QObjects). If you use .toStrongRef() on a QWeakPointer to a QObject without going through QSharedPointer you are in UB land. > > In other words: this API is bad and will most likely be removed from Qt in the future. > > > Thanks for the explanation. With "except in this one case" in the description you mean which case? Using it on QObjects? The API will most likely be removed, this means the whole concept of QWeakPointer? QWeakPointer is just fine. QWeakPointer for QObjects is not, when not using QSharedPointer. So the constructor QWeakPointer::QWeakPointer<QObject>(object) will be removed. REPOSITORY R108 KWin REVISION DETAIL https://phabricator.kde.org/D23070 To: gladhorn, #kwin Cc: romangg, kwin, LeGast00n, sbergeron, jraleigh, fbampaloukas, GB_2, mkulinski, ragreen, jackyalcine, Pitel, iodelay, crozbo, bwowk, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart