Re: [PATCH 2/2] Fix VarsTreeView memory management



Dodji Seketeli <dodji seketeli org> a écrit:

> When using Nemiver from master on GNOME 3, I noticed warnings like
> this in the terminal:
>
>     g_object_unref: assertion `G_IS_OBJECT (object)' failed
>
> As often, it turned out this is due to some memory management issue.
> The VarsTreeView widget is reused in the following components:
> LocalVarsInspector, GlobalVarsInspector and VarInspectorDialog.  These
> components hand out the VarsTreeView widget which eventually gets packed
> into some other composite container.  Obviously the VarsTreeView should
> be handled by Gtk::manage so that when the composite container is
> destroyed, the VarsTreeView gets destroyed too.
>
> The problem in this case was that instead of using Gtk::manage, the
> relevant componts were using SafePtrs to handle the life cycle of the
> VarsTreeView.  This patch fixes that.
>
> Tested on GNOME 3, applied to master.
>
> 	* src/persp/dbgperspective/nmv-vars-treeview.h
> 	(VarsTreeView::create): Change return type from a SafePtr to a
> 	bare VarsTreeView* pointer.
> 	* src/persp/dbgperspective/nmv-vars-treeview.cc
> 	(VarsTreeView::create): Likewise.  Return a VarsTreeView* now.
> 	The caller has either to call Gtk::manage on the result of
> 	VarsTreeView::create or delete it by hand.
> 	* src/persp/dbgperspective/nmv-local-vars-inspector.cc
> 	(LocalVarsInspector::Priv::tree_view): Change the type of this
> 	member from a SafePtr to a bare VarsTreeView* pointer.
> 	(LocalVarsInspector::Priv::Priv):
> 	Initialize LocalVarsInspector::Priv::tree_view with the result of
> 	VarsTreeView passed to Gtk::manage.  Avoid doing the (wrong)
> 	tree_view.reference() dance I was doing before.
> 	* src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc
> 	(GlobalVarsInspectorDialog::Priv::tree_view): Change the type of
> 	this member from a SafePtr to a bare VarsTreeView* pointer.
> 	* src/uicommon/nmv-dialog.cc (Dialog::Priv::Priv): Fix indentation.

I have just tested and applied this to the gtk2-branch too.

-- 
		Dodji


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]