anametologin / krohnkite

A dynamic tiling extension for KWin
MIT License
293 stars 15 forks source link

Krohnkite script makes kwin crash #73

Open zzag opened 2 weeks ago

zzag commented 2 weeks ago

We (KWin upstream) have received a substantial number of crash reports from users who use Krohnkite script https://crash-reports.kde.org/organizations/kde/issues/36968

The culprit seems to be that Krohnkite can access window properties after the window has been closed. It's not supported behavior. Ideally, when a window is closed, a script should drop all its window references.

anametologin commented 2 weeks ago

I have a question. Krohnkite uses windowRemoved(KWin::Window *window) signal. https://github.com/anametologin/krohnkite/blob/3c546f45065d1b47a0ef077446fa04f91f972eaa/src/driver/kwin/kwindriver.ts#L355-L361

Can I use a given window reference inside signal's callback function?

zzag commented 2 weeks ago

Can I use a given window reference inside signal's callback function?

Yes, but you should not do anything about the window, e.g. resize it or make it fullscreen, etc. The windowRemoved() signal indicates that the window is already removed.

zzag commented 2 weeks ago

You can also read various properties of the window, just not change the window state. Also, you should not use the window object after the windowRemoved signal has been emitted.

zzag commented 2 weeks ago

https://invent.kde.org/plasma/kwin/-/merge_requests/6424 addresses the kwin crash, but in general, judging by the crash, the window is used some time after the windowRemoved signal has been emitted

anametologin commented 1 day ago

https://github.com/anametologin/krohnkite/issues/79#issuecomment-2393189472