Showing the tip will in turn call getDesktopScaleFactor(), accessing the
lastComponentUnderMouse. In some cases, it was possible for
lastComponentUnderMouse to point to a deleted component, resulting in
UB.
There are two changes in this PR:
- Using a SafePointer rather than a raw pointer ensures that calls to
getDesktopScaleFactor() will always be safe, regardless of when they
happen.
- Moving the assignment of lastComponentUnderMouse to before the call to
displayTipInternal() ensures that the returned scale factor is that of
the component that the mouse is currently hovering.