Re: Patch to fix a hildon-1 bug



On 7/25/07, Michael Dominic K. <mdk mdk am> wrote:
> On 7/25/07, Zhu, Peter J <peter j zhu intel com> wrote:
> > Hi,
> >
> > Here I send a patch at end of this mail to fix a hildon-1 bug that will
> > cause program crash as hildon window is destroied in some
> > cases(Specially the it returns FALSE in the delete-event processing of
> > that windo).
> >
> > Basically, the GtkBorder widget should be freed with gtk_border_free()
> > rather than using g_free if it's NOT created by g_malloc.
> >
> > diff --git a/src/hildon-window.c b/src/hildon-window.c
> > index 1f1fac6..6e67057 100644
> > --- a/src/hildon-window.c
> > +++ b/src/hildon-window.c
> > @@ -380,9 +380,9 @@ hildon_window_finalize
> > (GObject * o
> >
> >      self = HILDON_WINDOW (obj_self);
> >
> > -    g_free (priv->borders);
> > -    g_free (priv->toolbar_borders);
> > -
> > +    gtk_border_free(priv->borders);
> > +    gtk_border_free(priv->toolbar_borders);
> > +
> >      if (G_OBJECT_CLASS (parent_class)->finalize)
> >          G_OBJECT_CLASS (parent_class)->finalize (obj_self);
> >
> > @@ -488,6 +488,8 @@ hildon_window_get_borders
> > (HildonWindo
> >
> >      g_free (priv->borders);
> >      g_free (priv->toolbar_borders);
> > +    priv->borders = NULL;
> > +    priv->toolbar_borders = NULL;
> >
> >      gtk_widget_style_get (GTK_WIDGET (window),
> > "borders",&priv->borders,
> >              "toolbar-borders", &priv->toolbar_borders,
> >
> >
> >
>
> Thanks for spotting the problem and the patch. This is not the first
> time we run into this kind of issues (mismatched allocation/freeing
> types). I personally think it's a bit API fault, which doesn't provide
> gtk_border_new (similiar case -- GdkColor structure that has an _free
> but not _new).
>
>
> --
> Michael.
>

I applied to hildon-1 trunk a slightly modified version of this patch
that fixes the problem. Again, thanks for contribution.

-- 
Michael.



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