background: Use memory management helpers more
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
This commit is contained in:
parent
2aea404b14
commit
1cc82cf759
@ -96,32 +96,20 @@ free_fbos (MetaBackground *self)
|
|||||||
MetaBackgroundMonitor *monitor = &self->monitors[i];
|
MetaBackgroundMonitor *monitor = &self->monitors[i];
|
||||||
|
|
||||||
g_clear_object (&monitor->fbo);
|
g_clear_object (&monitor->fbo);
|
||||||
if (monitor->texture)
|
cogl_clear_object (&monitor->texture);
|
||||||
{
|
|
||||||
cogl_object_unref (monitor->texture);
|
|
||||||
monitor->texture = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_color_texture (MetaBackground *self)
|
free_color_texture (MetaBackground *self)
|
||||||
{
|
{
|
||||||
if (self->color_texture != NULL)
|
cogl_clear_object (&self->color_texture);
|
||||||
{
|
|
||||||
cogl_object_unref (self->color_texture);
|
|
||||||
self->color_texture = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_wallpaper_texture (MetaBackground *self)
|
free_wallpaper_texture (MetaBackground *self)
|
||||||
{
|
{
|
||||||
if (self->wallpaper_texture != NULL)
|
cogl_clear_object (&self->wallpaper_texture);
|
||||||
{
|
|
||||||
cogl_object_unref (self->wallpaper_texture);
|
|
||||||
self->wallpaper_texture = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
self->wallpaper_allocation_failed = FALSE;
|
self->wallpaper_allocation_failed = FALSE;
|
||||||
}
|
}
|
||||||
@ -130,8 +118,7 @@ static void
|
|||||||
invalidate_monitor_backgrounds (MetaBackground *self)
|
invalidate_monitor_backgrounds (MetaBackground *self)
|
||||||
{
|
{
|
||||||
free_fbos (self);
|
free_fbos (self);
|
||||||
g_free (self->monitors);
|
g_clear_pointer (&self->monitors, g_free);
|
||||||
self->monitors = NULL;
|
|
||||||
self->n_monitors = 0;
|
self->n_monitors = 0;
|
||||||
|
|
||||||
if (self->display)
|
if (self->display)
|
||||||
@ -260,8 +247,7 @@ set_file (MetaBackground *self,
|
|||||||
g_signal_handlers_disconnect_by_func (*imagep,
|
g_signal_handlers_disconnect_by_func (*imagep,
|
||||||
(gpointer)on_background_loaded,
|
(gpointer)on_background_loaded,
|
||||||
self);
|
self);
|
||||||
g_object_unref (*imagep);
|
g_clear_object (imagep);
|
||||||
*imagep = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_set_object (filep, file);
|
g_set_object (filep, file);
|
||||||
@ -693,8 +679,7 @@ ensure_wallpaper_texture (MetaBackground *self,
|
|||||||
*/
|
*/
|
||||||
g_error_free (catch_error);
|
g_error_free (catch_error);
|
||||||
|
|
||||||
cogl_object_unref (self->wallpaper_texture);
|
cogl_clear_object (&self->wallpaper_texture);
|
||||||
self->wallpaper_texture = NULL;
|
|
||||||
g_object_unref (fbo);
|
g_object_unref (fbo);
|
||||||
|
|
||||||
self->wallpaper_allocation_failed = TRUE;
|
self->wallpaper_allocation_failed = TRUE;
|
||||||
@ -855,8 +840,7 @@ meta_background_get_texture (MetaBackground *self,
|
|||||||
* we'll try again the next time this is called. (MetaBackgroundActor
|
* we'll try again the next time this is called. (MetaBackgroundActor
|
||||||
* caches the result, so user might be left without a background.)
|
* caches the result, so user might be left without a background.)
|
||||||
*/
|
*/
|
||||||
cogl_object_unref (monitor->texture);
|
cogl_clear_object (&monitor->texture);
|
||||||
monitor->texture = NULL;
|
|
||||||
g_clear_object (&monitor->fbo);
|
g_clear_object (&monitor->fbo);
|
||||||
|
|
||||||
g_error_free (catch_error);
|
g_error_free (catch_error);
|
||||||
|
Loading…
Reference in New Issue
Block a user