Use clutter_actor_destroy in dispose, add _dispose where needed
ClutterGroup calls _destroy, but most of St was just calling _unparent. This caused problems because the DESTROY signal was not emitted for child elements after destroying a toplevel. Also, in a GC'd binding it would cause unpredictable lifetime of children. Some St widgets simply didn't have _dispose at all; implement it. Note because of the usage of the background_image in StButton, we can't cleanly destroy it inside the StWidget. https://bugzilla.gnome.org/show_bug.cgi?id=597845
This commit is contained in:
parent
a27c29f4fc
commit
ab0460ad59
@ -352,10 +352,8 @@ st_bin_dispose (GObject *gobject)
|
|||||||
StBinPrivate *priv = ST_BIN (gobject)->priv;
|
StBinPrivate *priv = ST_BIN (gobject)->priv;
|
||||||
|
|
||||||
if (priv->child)
|
if (priv->child)
|
||||||
{
|
clutter_actor_destroy (priv->child);
|
||||||
clutter_actor_unparent (priv->child);
|
g_assert (priv->child == NULL);
|
||||||
priv->child = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (st_bin_parent_class)->dispose (gobject);
|
G_OBJECT_CLASS (st_bin_parent_class)->dispose (gobject);
|
||||||
}
|
}
|
||||||
|
@ -403,11 +403,7 @@ st_box_layout_dispose (GObject *object)
|
|||||||
StBoxLayoutPrivate *priv = ST_BOX_LAYOUT (object)->priv;
|
StBoxLayoutPrivate *priv = ST_BOX_LAYOUT (object)->priv;
|
||||||
|
|
||||||
while (priv->children)
|
while (priv->children)
|
||||||
{
|
clutter_actor_destroy (priv->children->data);
|
||||||
clutter_actor_unparent (CLUTTER_ACTOR (priv->children->data));
|
|
||||||
|
|
||||||
priv->children = g_list_delete_link (priv->children, priv->children);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->hadjustment)
|
if (priv->hadjustment)
|
||||||
{
|
{
|
||||||
|
@ -162,7 +162,7 @@ st_entry_dispose (GObject *object)
|
|||||||
|
|
||||||
if (priv->entry)
|
if (priv->entry)
|
||||||
{
|
{
|
||||||
clutter_actor_unparent (priv->entry);
|
clutter_actor_destroy (priv->entry);
|
||||||
priv->entry = NULL;
|
priv->entry = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,6 +183,20 @@ st_label_allocate (ClutterActor *actor,
|
|||||||
clutter_actor_allocate (priv->label, &content_box, flags);
|
clutter_actor_allocate (priv->label, &content_box, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
st_label_dispose (GObject *actor)
|
||||||
|
{
|
||||||
|
StLabelPrivate *priv = ST_LABEL (actor)->priv;
|
||||||
|
|
||||||
|
if (priv->label)
|
||||||
|
{
|
||||||
|
clutter_actor_destroy (priv->label);
|
||||||
|
priv->label = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (st_label_parent_class)->dispose (G_OBJECT (actor));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
st_label_paint (ClutterActor *actor)
|
st_label_paint (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
@ -227,6 +241,7 @@ st_label_class_init (StLabelClass *klass)
|
|||||||
|
|
||||||
gobject_class->set_property = st_label_set_property;
|
gobject_class->set_property = st_label_set_property;
|
||||||
gobject_class->get_property = st_label_get_property;
|
gobject_class->get_property = st_label_get_property;
|
||||||
|
gobject_class->dispose = st_label_dispose;
|
||||||
|
|
||||||
actor_class->paint = st_label_paint;
|
actor_class->paint = st_label_paint;
|
||||||
actor_class->allocate = st_label_allocate;
|
actor_class->allocate = st_label_allocate;
|
||||||
|
@ -129,13 +129,13 @@ st_scroll_view_dispose (GObject *object)
|
|||||||
|
|
||||||
if (priv->vscroll)
|
if (priv->vscroll)
|
||||||
{
|
{
|
||||||
clutter_actor_unparent (priv->vscroll);
|
clutter_actor_destroy (priv->vscroll);
|
||||||
priv->vscroll = NULL;
|
priv->vscroll = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->hscroll)
|
if (priv->hscroll)
|
||||||
{
|
{
|
||||||
clutter_actor_unparent (priv->hscroll);
|
clutter_actor_destroy (priv->hscroll);
|
||||||
priv->hscroll = NULL;
|
priv->hscroll = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,15 +271,9 @@ static void
|
|||||||
st_table_dispose (GObject *gobject)
|
st_table_dispose (GObject *gobject)
|
||||||
{
|
{
|
||||||
StTablePrivate *priv = ST_TABLE (gobject)->priv;
|
StTablePrivate *priv = ST_TABLE (gobject)->priv;
|
||||||
GSList *l, *next;
|
|
||||||
|
|
||||||
for (l = priv->children; l;)
|
while (priv->children)
|
||||||
{
|
clutter_actor_destroy (priv->children->data);
|
||||||
next = l->next;
|
|
||||||
clutter_container_remove_actor ((ClutterContainer *) gobject,
|
|
||||||
CLUTTER_ACTOR (l->data));
|
|
||||||
l = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (st_table_parent_class)->dispose (gobject);
|
G_OBJECT_CLASS (st_table_parent_class)->dispose (gobject);
|
||||||
}
|
}
|
||||||
|
@ -355,6 +355,20 @@ st_tooltip_unmap (ClutterActor *self)
|
|||||||
clutter_actor_unmap (priv->label);
|
clutter_actor_unmap (priv->label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
st_tooltip_dispose (GObject *self)
|
||||||
|
{
|
||||||
|
StTooltipPrivate *priv = ST_TOOLTIP (self)->priv;
|
||||||
|
|
||||||
|
if (priv->label)
|
||||||
|
{
|
||||||
|
clutter_actor_destroy (priv->label);
|
||||||
|
priv->label = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (st_tooltip_parent_class)->dispose (self);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
st_tooltip_class_init (StTooltipClass *klass)
|
st_tooltip_class_init (StTooltipClass *klass)
|
||||||
{
|
{
|
||||||
@ -367,6 +381,7 @@ st_tooltip_class_init (StTooltipClass *klass)
|
|||||||
|
|
||||||
gobject_class->set_property = st_tooltip_set_property;
|
gobject_class->set_property = st_tooltip_set_property;
|
||||||
gobject_class->get_property = st_tooltip_get_property;
|
gobject_class->get_property = st_tooltip_get_property;
|
||||||
|
gobject_class->dispose = st_tooltip_dispose;
|
||||||
|
|
||||||
actor_class->get_preferred_width = st_tooltip_get_preferred_width;
|
actor_class->get_preferred_width = st_tooltip_get_preferred_width;
|
||||||
actor_class->get_preferred_height = st_tooltip_get_preferred_height;
|
actor_class->get_preferred_height = st_tooltip_get_preferred_height;
|
||||||
|
Loading…
Reference in New Issue
Block a user