mirror of
https://github.com/brl/mutter.git
synced 2025-05-07 23:54:56 +00:00
Fix some *_set functions so they work if the object is the same value
Bug 1392 - behaviour_set_alpha set same alpha twice lead to warning and destroy the input alpha The following functions are fixed: clutter_actor_set_shader clutter_alpha_set_timeline clutter_behaviour_set_alpha clutter_clone_texture_set_parent_texture They either now reference the new value before destroying the old value, or just return immediately if the values are the same.
This commit is contained in:
parent
62cfc6487f
commit
39f4848b93
@ -7224,11 +7224,11 @@ clutter_actor_set_shader (ClutterActor *self,
|
|||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
||||||
g_return_val_if_fail (shader == NULL || CLUTTER_IS_SHADER (shader), FALSE);
|
g_return_val_if_fail (shader == NULL || CLUTTER_IS_SHADER (shader), FALSE);
|
||||||
|
|
||||||
|
if (shader)
|
||||||
|
g_object_ref (shader);
|
||||||
|
else
|
||||||
/* if shader passed in is NULL we destroy the shader */
|
/* if shader passed in is NULL we destroy the shader */
|
||||||
if (shader == NULL)
|
|
||||||
{
|
|
||||||
destroy_shader_data (self);
|
destroy_shader_data (self);
|
||||||
}
|
|
||||||
|
|
||||||
actor_priv = self->priv;
|
actor_priv = self->priv;
|
||||||
shader_data = actor_priv->shader_data;
|
shader_data = actor_priv->shader_data;
|
||||||
@ -7242,15 +7242,9 @@ clutter_actor_set_shader (ClutterActor *self,
|
|||||||
shader_value_free);
|
shader_value_free);
|
||||||
}
|
}
|
||||||
if (shader_data->shader)
|
if (shader_data->shader)
|
||||||
{
|
|
||||||
g_object_unref (shader_data->shader);
|
g_object_unref (shader_data->shader);
|
||||||
shader_data->shader = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shader)
|
shader_data->shader = shader;
|
||||||
{
|
|
||||||
shader_data->shader = g_object_ref (shader);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
||||||
clutter_actor_queue_redraw (self);
|
clutter_actor_queue_redraw (self);
|
||||||
|
@ -395,6 +395,9 @@ clutter_alpha_set_timeline (ClutterAlpha *alpha,
|
|||||||
|
|
||||||
priv = alpha->priv;
|
priv = alpha->priv;
|
||||||
|
|
||||||
|
if (priv->timeline == timeline)
|
||||||
|
return;
|
||||||
|
|
||||||
if (priv->timeline)
|
if (priv->timeline)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (priv->timeline,
|
g_signal_handlers_disconnect_by_func (priv->timeline,
|
||||||
|
@ -570,6 +570,9 @@ clutter_behaviour_set_alpha (ClutterBehaviour *behave,
|
|||||||
|
|
||||||
priv = behave->priv;
|
priv = behave->priv;
|
||||||
|
|
||||||
|
if (alpha)
|
||||||
|
g_object_ref_sink (alpha);
|
||||||
|
|
||||||
if (priv->notify_id)
|
if (priv->notify_id)
|
||||||
{
|
{
|
||||||
CLUTTER_NOTE (BEHAVIOUR, "removing previous notify-id (%d)",
|
CLUTTER_NOTE (BEHAVIOUR, "removing previous notify-id (%d)",
|
||||||
@ -590,7 +593,6 @@ clutter_behaviour_set_alpha (ClutterBehaviour *behave,
|
|||||||
if (alpha)
|
if (alpha)
|
||||||
{
|
{
|
||||||
priv->alpha = alpha;
|
priv->alpha = alpha;
|
||||||
g_object_ref_sink (priv->alpha);
|
|
||||||
|
|
||||||
priv->notify_id = g_signal_connect (priv->alpha, "notify::alpha",
|
priv->notify_id = g_signal_connect (priv->alpha, "notify::alpha",
|
||||||
G_CALLBACK(notify_cb),
|
G_CALLBACK(notify_cb),
|
||||||
|
@ -221,6 +221,9 @@ set_parent_texture (ClutterCloneTexture *ctexture,
|
|||||||
ClutterActor *actor = CLUTTER_ACTOR (ctexture);
|
ClutterActor *actor = CLUTTER_ACTOR (ctexture);
|
||||||
gboolean was_visible = CLUTTER_ACTOR_IS_VISIBLE (ctexture);
|
gboolean was_visible = CLUTTER_ACTOR_IS_VISIBLE (ctexture);
|
||||||
|
|
||||||
|
if (priv->parent_texture == texture)
|
||||||
|
return;
|
||||||
|
|
||||||
if (priv->parent_texture)
|
if (priv->parent_texture)
|
||||||
{
|
{
|
||||||
g_object_unref (priv->parent_texture);
|
g_object_unref (priv->parent_texture);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user