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>
This commit is contained in:
Florian Müllner 2023-02-02 14:56:45 +01:00 committed by Marge Bot
parent 1993f362d2
commit 888a0ad623

View File

@ -366,6 +366,9 @@ shell_window_preview_layout_add_window (ShellWindowPreviewLayout *self,
GHashTableIter iter;
gpointer value;
g_return_val_if_fail (SHELL_IS_WINDOW_PREVIEW_LAYOUT (self), NULL);
g_return_val_if_fail (META_IS_WINDOW (window), NULL);
priv = shell_window_preview_layout_get_instance_private (self);
g_hash_table_iter_init (&iter, priv->windows);
@ -425,6 +428,9 @@ shell_window_preview_layout_remove_window (ShellWindowPreviewLayout *self,
GHashTableIter iter;
gpointer key, value;
g_return_if_fail (SHELL_IS_WINDOW_PREVIEW_LAYOUT (self));
g_return_if_fail (META_IS_WINDOW (window));
priv = shell_window_preview_layout_get_instance_private (self);
g_hash_table_iter_init (&iter, priv->windows);
@ -473,6 +479,8 @@ shell_window_preview_layout_get_windows (ShellWindowPreviewLayout *self)
GHashTableIter iter;
gpointer value;
g_return_val_if_fail (SHELL_IS_WINDOW_PREVIEW_LAYOUT (self), NULL);
priv = shell_window_preview_layout_get_instance_private (self);
g_hash_table_iter_init (&iter, priv->windows);