GNOME Bugzilla – Bug 619530
Glade crash when adding GtkNotebook
Last modified: 2012-02-22 10:03:10 UTC
Hi, I just tested the 3.7.1 release of glade and i cant do anything since it crash everytime i want to add a notebook in my window. Just create a new window and add a gtknotebook, it's the same when i create a new window, add a vertical box and then add a notebook. Thanks.
It seems to happen with a lot of ui component, the toolbar and menubar for example. I got this error : GladeUI:ERROR:glade-project.c:4354:glade_project_model_get_path: assertion failed: (child != NULL)
Right, I'm quite sure this is fixed in master but it needs to be verified... (git master has a fix in the order of recursively adding objects to the project, a bug that sneaked in with the GladeProject implementing GtkTreeModel stuff).
*** Bug 622222 has been marked as a duplicate of this bug. ***
(In reply to comment #2) > Right, I'm quite sure this is fixed in master but it needs to be verified... > > (git master has a fix in the order of recursively adding objects to > the project, a bug that sneaked in with the GladeProject implementing > GtkTreeModel stuff). It's only fixed for some widgets. With master, frames work again, but notebooks still don't. When I add a notebook to a project with master I get this: GladeUI:ERROR:glade-project.c:4358:glade_project_model_get_path: assertion failed: (child != NULL)
*** Bug 622253 has been marked as a duplicate of this bug. ***
(In reply to comment #4) > (In reply to comment #2) > > Right, I'm quite sure this is fixed in master but it needs to be verified... > > > > (git master has a fix in the order of recursively adding objects to > > the project, a bug that sneaked in with the GladeProject implementing > > GtkTreeModel stuff). > > It's only fixed for some widgets. With master, frames work again, but notebooks > still don't. When I add a notebook to a project with master I get this: > > > GladeUI:ERROR:glade-project.c:4358:glade_project_model_get_path: assertion > failed: (child != NULL) I can confirm this: Breakpoint 4, glade_project_model_get_path (model=0x313ebe0, iter=0x27f474) at glade-project.c:4358 4358 g_assert (child != NULL); (gdb) bt
+ Trace 222560
$36 = (GList *) 0x0 (gdb) print children $37 = (GList *) 0x0 (gdb) print parent->name $38 = (gchar *) 0x30d12e0 "notebook1" (gdb) print widget->name $39 = (gchar *) 0x3c61520 "label1" (gdb) print widget->parent $40 = (GladeWidget *) 0x3c2bee0 (gdb) The widget "label1" has "notebook1" as parent, but "notebook1" have no children at the time. I can try to fix it, but some pointers would be appreciated.
The fix wont be so easy; the problem is as such: Because we went from GladeProject bits cached inside a GtkTreeStore to display in the inspector... to a GladeProject that actually implements the GtkTreeModel (cleaner/better design), the order in which objects are added to the project suddenly has an impact on the core. So an advance warning, fixing this bug means to continue work refactoring started by Johannes Schmid (as this is our future core, a patch here will undergo a thorough review) The solution can be: a.) Making the GladeProject more vigorous about how it updates when a child appears in the model before the parent. b.) Trying to make the glade-gtk.c plugin code never call glade_project_add_object() and leave that entirely to the glade-command.c code (undo/redo controller where most of that is done already). 'b' would be better and more generally important, only the GladeCommand module should be allowed to add/remove objects from the project anyway (cases where the plugin add objects to the project are mostly redundant anyway).
Thanks, will have a look as soon as possible.
From the tree model implementation (at least the way I did it) I think it is rather impossible to add a child before it parents as this doesn't make sense in a tree. So, b) would be the way to go. Are there other widgets besides notebooks that have that problem?
Yes, searching through plugins/gtk+/glade-gtk.c for the text glade_command_create() and glade_project_add_object() you should find the cases where widgets are manually created by the plugin, some off the top of my head: - The GtkExpander label is manually created - The GtkFrame's added alignment/label - The GtkMenuBar subhierarchy hierarchy created along with a menubar Another probable bug comes to mind along the same lines: Its also a good idea to look at glade_widget_rebuild() code, this code (this is used whenever changing a construct-only property): - removes a widget from it's parent - removes all children from the widget - frees the widget instance and builds a replacement - re-adds the children with all their recorded packing properties - re-adds the widget to its parent As I recall, there's a reason why this above code also touches the widget's 'project'...
Sorry, started to look at this, then away for holidays, box troubles, etc. Anyhow, removing glade_project_add_object() "fixes" the crash, and the label is visible in the design area, but not added to the 'project' - the reason that you wanted to recall :) I will look at it maybe this weekend, or latest next week, but the other's are already fixed, I just did not really have a good look at how to try and migrate the fix, but will look at your suggestions, thanks. There is also some tab cleanup code there that I do not get - as the tab objects never seem to exist as GladeWidgets, but I'll mention that again when I get there.
Created attachment 165790 [details] [review] glade3-notebook-2.patch GtkExpander seems to be ok. GtkFrame shows 2 label objects in the project list, with console output like: ----- (glade-3.exe:8848): GladeUI-CRITICAL **: glade_widget_get_from_gobject: assertion `G_IS_OBJECT (object)' failed (glade-3.exe:8848): GladeUI-CRITICAL **: glade_widget_get_children: assertion `GLADE_IS_WIDGET (widget)' failed (glade-3.exe:8848): GLib-GObject-CRITICAL **: g_object_set_property: assertion `G_IS_VALUE (value)' failed (glade-3.exe:8848): GLib-GObject-CRITICAL **: g_value_unset: assertion `G_IS_VALUE (value)' failed ----- Attached patch is one version of various ways I tried to fix it. It relatively works in that: - project loading is fine - you can add and remove tabs without problem Issues: - labels of newly added tabs do not show up in the project list, and the handlers are not active This however is fixed if you change the naming policy, so not sure if this is a problem higher up? I tried to fix the duplicate label issue for GtkFrame, and this works for the first frame added, but not the second add. Either way, changing the naming policy it is fixed again. So it seems like there might be another issue higher up with the project code?
Created attachment 174210 [details] [review] Patch to fix some assertion issues This patch removes an assertion and fails more gratefully. This doesn't seem to harm in the tree view so I guess it's ok.
Review of attachment 174210 [details] [review]: commited: http://git.gnome.org/browse/glade3/commit/?id=23b54570033436349238cdd8cbc0f97dd48ffe12
Which release(s) was this fixed in ? I checked the release notes for 3.7.2 and 3.7.3, but didn't see this bug listed.
According to git it was fixed in 3.7.3 but who generally cares, it's fixed in any of the stable version (3.8.x and 3.10.x).
Thank you. We can't move up to 3.8.X (GTK dependency issue) so I needed to know specifically for 3.7.X.
The patch from comment #14 was applied to 3.7.3 (just verified it, did not verify if the crash do not happen - I do not have a build with 3.7.3 handy right now, sorry).