Commit Graph

5 Commits

Author SHA1 Message Date
Carlos Garnacho
356bab1121 shell: Use swapped signal connection for MetaWindowActor::destroy
The callback would schedule a clutter_actor_destroy() on the first
argument. Unless told otherwise, this is the same actor that is
already being destroyed, so this is a no-op.

Instead, the intent is to make the clone follow up destruction of
the window actor so that it results in correct removal of this
window from the ShellWindowPreviewLayout. Use a swapped connection
to pass the clone actor as the first argument of the signal callback.

Fixes: 04c781674c ("Move WindowPreviewLayout from JS to C")

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6570
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2756>
2023-05-03 14:00:33 +00:00
Florian Müllner
888a0ad623 shell/window-preview-layout: Add precondition checks
It's good practice to guard public API against programmer errors,
so do that.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6351

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2622>
2023-02-02 19:56:08 +00:00
Florian Müllner
1993f362d2 shell/window-preview-layout: Mark return value as nullable
The function may return null, so we should mark it as such, even
if that information is currently unused.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6351

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2622>
2023-02-02 19:56:08 +00:00
Sebastian Keller
8c40b48a09 shell/window-preview-layout: Fix memory leaks
The WindowInfo allocated when adding a window was not getting free'd
when the window was getting removed again or the layout was getting
disposed. Also the hash table in which the WindowInfos are stored was
not getting free'd on destruction either. Both could result in small
leaks after closing the overview.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5238
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2256>
2022-04-22 15:02:29 +00:00
Jonas Dreßler
04c781674c Move WindowPreviewLayout from JS to C
This layout manager is used quite often and the time we spend calling
it's allocate and get_preferred_width/heigth functions increases with
every open window.

We can save a lot of precious time during the layout cycle by moving
this layout manager from JS to C, thus avoiding the overhead of
trampolining between C and JS land.

In a measurement where the average time spent in vfunc_allocate() of the
Workspace actor was measured while opening an overview with 20 windows,
the average time spent went down from 3.1 ms to 2.3 ms.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
2021-03-09 15:40:49 +00:00