Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ZenWalker
Glade
Commits
63672d17
Commit
63672d17
authored
Dec 20, 2010
by
Tristan Van Berkom
Browse files
Moved unparenting of all widgets back to GladeProject at dispose time.
This ensures that the deepest children are finalized first.
parent
e551f1d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
gladeui/glade-project.c
View file @
63672d17
...
...
@@ -257,6 +257,34 @@ glade_project_list_unref (GList *original_list)
g_list_free
(
original_list
);
}
static
void
unparent_objects_recurse
(
GladeWidget
*
widget
)
{
GladeWidget
*
child
;
GList
*
children
,
*
list
;
/* Unparent all children */
if
((
children
=
glade_widget_get_children
(
widget
))
!=
NULL
)
{
for
(
list
=
children
;
list
;
list
=
list
->
next
)
{
child
=
glade_widget_get_from_gobject
(
list
->
data
);
unparent_objects_recurse
(
child
);
if
(
child
->
internal
==
NULL
)
{
g_print
(
"Project dispose unreffing %s's child %s
\n
"
,
widget
->
name
,
child
->
name
);
glade_widget_remove_child
(
widget
,
child
);
}
}
g_list_free
(
children
);
}
}
static
void
glade_project_dispose
(
GObject
*
object
)
{
...
...
@@ -274,9 +302,22 @@ glade_project_dispose (GObject *object)
/* Remove objects from the project */
tree
=
g_list_copy
(
project
->
priv
->
tree
);
for
(
list
=
tree
;
list
;
list
=
list
->
next
)
{
GladeWidget
*
gwidget
=
glade_widget_get_from_gobject
(
list
->
data
);
g_object_ref
(
gwidget
);
glade_project_remove_object
(
project
,
list
->
data
);
unparent_objects_recurse
(
gwidget
);
g_object_unref
(
gwidget
);
}
g_list_free
(
tree
);
g_assert
(
project
->
priv
->
tree
==
NULL
);
g_assert
(
project
->
priv
->
objects
==
NULL
);
G_OBJECT_CLASS
(
glade_project_parent_class
)
->
dispose
(
object
);
}
...
...
gladeui/glade-widget.c
View file @
63672d17
...
...
@@ -168,9 +168,9 @@ glade_widget_remove_child_impl (GladeWidget *widget,
glade_widget_adaptor_remove
(
widget
->
adaptor
,
widget
->
object
,
child
->
object
);
g_object_unref
(
child
);
child
->
parent
=
NULL
;
g_object_unref
(
child
);
}
static
void
...
...
@@ -855,20 +855,6 @@ glade_widget_dispose (GObject *object)
glade_widget_push_superuser
();
/* Unparent all children */
if
((
children
=
glade_widget_get_children
(
widget
))
!=
NULL
)
{
for
(
list
=
children
;
list
;
list
=
list
->
next
)
{
child
=
glade_widget_get_from_gobject
(
list
->
data
);
if
(
child
->
internal
==
NULL
)
glade_widget_remove_child
(
widget
,
child
);
}
g_list_free
(
children
);
}
/* Release references by way of object properties... */
while
(
widget
->
prop_refs
)
{
...
...
@@ -3384,7 +3370,6 @@ glade_widget_set_object (GladeWidget *gwidget, GObject *new_object, gboolean des
if
(
gwidget
->
internal
==
NULL
)
{
#if _YOU_WANT_TO_LOOK_AT_PROJECT_REFCOUNT_BALANCING_
g_print
(
"Killing '%s::%s' widget's object with reference count %d
\n
"
,
gwidget
->
adaptor
->
name
,
gwidget
->
name
?
gwidget
->
name
:
"(unknown)"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment