Skip to content

[style] Reparent window shadows to widgets

Vlad Zahorodnii requested to merge work/fix-shadow-crash into Plasma/5.19

We would like to destroy a shadow after the decorated window has gotten unmapped or destroyed. To do that, we install an event filter on the widget and make the shadow a child of the underlying window.

Unfortunately, the underlying window and the widget have different life times. To counter for that, we clean up _shadows after the shadow has been destroyed. This turned out to be a really bad idea because when someone does qDeleteAll(_shadows), QMap iterators will become invalid.

Since KWindowShadow handles the case where it becomes orphaned gracefully, we can make shadows children of widgets to work around the crash.

Still, it would be nice to call KWindowShadow::destroy() after the native resources for the window have been destroyed.

Edited by Vlad Zahorodnii

Merge request reports