clutter/offscreen-effect: Use g_clear_pointer for cleanup
It does the exact same checks, and saves us a few lines of code. https://gitlab.gnome.org/GNOME/mutter/merge_requests/992
This commit is contained in:
parent
802309caf9
commit
3958e75ed2
@ -118,11 +118,7 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
|
|||||||
meta_class->set_actor (meta, actor);
|
meta_class->set_actor (meta, actor);
|
||||||
|
|
||||||
/* clear out the previous state */
|
/* clear out the previous state */
|
||||||
if (priv->offscreen != NULL)
|
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||||
{
|
|
||||||
cogl_object_unref (priv->offscreen);
|
|
||||||
priv->offscreen = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we keep a back pointer here, to avoid going through the ActorMeta */
|
/* we keep a back pointer here, to avoid going through the ActorMeta */
|
||||||
priv->actor = clutter_actor_meta_get_actor (meta);
|
priv->actor = clutter_actor_meta_get_actor (meta);
|
||||||
@ -198,17 +194,8 @@ update_fbo (ClutterEffect *effect,
|
|||||||
ensure_pipeline_filter_for_scale (self, resource_scale);
|
ensure_pipeline_filter_for_scale (self, resource_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->texture != NULL)
|
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||||
{
|
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||||
cogl_object_unref (priv->texture);
|
|
||||||
priv->texture = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->offscreen != NULL)
|
|
||||||
{
|
|
||||||
cogl_object_unref (priv->offscreen);
|
|
||||||
priv->offscreen = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->texture =
|
priv->texture =
|
||||||
clutter_offscreen_effect_create_texture (self, target_width, target_height);
|
clutter_offscreen_effect_create_texture (self, target_width, target_height);
|
||||||
@ -502,14 +489,9 @@ clutter_offscreen_effect_finalize (GObject *gobject)
|
|||||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (gobject);
|
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (gobject);
|
||||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||||
|
|
||||||
if (priv->offscreen)
|
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||||
cogl_object_unref (priv->offscreen);
|
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||||
|
g_clear_pointer (&priv->target, cogl_object_unref);
|
||||||
if (priv->target)
|
|
||||||
cogl_object_unref (priv->target);
|
|
||||||
|
|
||||||
if (priv->texture)
|
|
||||||
cogl_object_unref (priv->texture);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
|
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user