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> |
||
---|---|---|
.. | ||
auto | ||
baseline | ||
benchmarks | ||
global | ||
libfuzzer | ||
manual | ||
shared | ||
testserver | ||
CMakeLists.txt | ||
README |
This directory contains autotests and benchmarks based on Qt Test. In order to run the autotests reliably, you need to configure a desktop to match the test environment that these tests are written for. Linux X11: * The user must be logged in to an active desktop; you can't run the autotests without a valid DISPLAY that allows X11 connections. * The tests are run against a KDE3 or KDE4 desktop. * Window manager uses "click to focus", and not "focus follows mouse". Many tests move the mouse cursor around and expect this to not affect focus and activation. * Disable "click to activate", i.e., when a window is opened, the window manager should automatically activate it (give it input focus) and not wait for the user to click the window.