qt: fix null pointer dereference in `CompositorX11UISurface`
During initialization, QVLCTools::restoreWindowPosition()
is called before the
window is shown (intentionally, as we don't want to resize after showing the
window). This is done before the content is set, which makes root item point to
a valid location.
Unlike what its name suggests, QVLCTools::restoreWindowPosition()
may adjust
the size of the window which in turn may cause a resize event be generated, and
this event may be sent immediately (synchronous) and not deferred until going
back to the event loop.
In this case updateSizes()
may be called, which is normally expected to be
called when everything is ready (i.e., root item, and its window are valid
pointers).
We can simply check if the root item pointer is null in updateSizes()
,
and not dereference it if it is a null pointer. This should be safe because
when the root item is set, its size is set anyway.
We don't need to check for m_uiWindow
, because it is set during construction.
Close #28880 (closed).
Request review @chub.