89b6ad3ab5
When constructing a QWeakPointer<T> from a rvalue QWeakPointer<X>, even if X* is convertible to T*, actually doing the conversion requires access to the pointee's vtable in case of virtual inheritance. For instance: class Base { virtual ~Base(); }; class Derived : public virtual Base {}; Now given a `Derived *ptr`, then a conversion of `ptr` to `Base *` is implicit (it's a public base), but the compiler needs to dereference `ptr` to find out where the Base sub-object is. This access to the pointee requires protection, because by the time we attempt the cast the pointee may have already been destroyed, or it's being destroyed by another thread. Do that by going through a shared pointer. (This matches the existing code for the converting assignment.) This requires changing the private assign() method, used by QPointer, to avoid going through a converting move assignment/construction, because one can't upgrade a QWeakPointer tracking a QObject to a QSharedPointer. Given it's the caller's responsibility to guard the lifetime of the pointee passed into assign(), I can simply build a QWeakPointer<T> and use ordinary (i.e. non-converting) move assignment instead. Change-Id: I7743b334d479de7cefa6999395a33df06814c8f1 Pick-to: 6.5 6.6 Fixes: QTBUG-117483 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> |
||
---|---|---|
.. | ||
bic/data | ||
cmake | ||
concurrent | ||
corelib | ||
dbus | ||
gui | ||
guiapplauncher | ||
network | ||
opengl | ||
other | ||
printsupport | ||
shared | ||
sql | ||
testlib | ||
tools | ||
wasm | ||
widgets | ||
xml | ||
CMakeLists.txt | ||
network-settings.h |