Bug 437920

Summary: Plasma dialog shadow lost during fadeout animation on window close
Product: [Plasma] kwin Reporter: Kai Uwe Broulik <kde>
Component: effects-variousAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: minor CC: kde, nate, notmart
Priority: NOR Keywords: regression
Version First Reported In: 5.25.5   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.99
Sentry Crash Report:
Attachments: Dialog during fade out transition

Description Kai Uwe Broulik 2021-05-31 18:49:32 UTC
Created attachment 138909 [details]
Dialog during fade out transition

SUMMARY
The dialog shadow vanishes during the window's fade out transition

STEPS TO REPRODUCE
1. notify-send foo bar
2. wait for the notification to time out

OBSERVED RESULT
The popup fades out but immediately loses its shadow

EXPECTED RESULT
The popup fades out but has its shadow fade out like the rest of the dialog

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: git master as of 2021-05-23
KDE Frameworks Version: 5.82
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Can be more easily observed by reducing animation speed
Comment 1 Vlad Zahorodnii 2021-05-31 18:58:02 UTC
X11 or Wayland?
Comment 2 Kai Uwe Broulik 2021-05-31 20:01:04 UTC
X11
Comment 3 Vlad Zahorodnii 2021-06-07 07:11:46 UTC
It looks like the shadow is destroyed before the x11 window is unmapped or destroyed. iirc plasma dialog removes drop shadows before the window is destroyed.

KWindowShadow has to be destroyed after the QWindow is unmapped or destroyed.
Comment 4 Nate Graham 2022-09-08 05:06:27 UTC
Can still reproduce on X11.
Comment 5 David Edmundson 2022-09-08 14:44:22 UTC
Dialog::~Dialog()
{
    if (!QCoreApplication::instance()->closingDown()) {
        DialogShadows::self()->removeWindow(this);
    }

we can either explicitly call hide() or make dialogshadows automagically remove things connected to QObject::destroyed and then kill this line
(probably better?)
Comment 6 Marco Martin 2022-09-08 15:28:50 UTC
(In reply to Vlad Zahorodnii from comment #3)
> It looks like the shadow is destroyed before the x11 window is unmapped or
> destroyed. iirc plasma dialog removes drop shadows before the window is
> destroyed.
> 
> KWindowShadow has to be destroyed after the QWindow is unmapped or destroyed.

actually DialogShadows already is connected to the window destroyed signal,so the line can be safely just be removed
Comment 7 Bug Janitor Service 2022-09-08 15:31:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/596
Comment 8 Nate Graham 2022-09-08 15:43:35 UTC
Git commit 1e4b8bc19d6c4b3a632b790e97f16aeb50336434 by Nate Graham, on behalf of Marco Martin.
Committed on 08/09/2022 at 15:36.
Pushed by ngraham into branch 'master'.

don't remove the shadow on ~Dialog

DialogShadows already connects to the destroyed signal of the wondow and
already knows how to clean up when a window goes away.
Removing it in ~Dialog does it too soon and will result in a missing
shadow during the fadeout animation

M  +0    -4    src/plasmaquick/dialog.cpp

https://invent.kde.org/frameworks/plasma-framework/commit/1e4b8bc19d6c4b3a632b790e97f16aeb50336434