Stale memory accessed by GtkPlotCanvas?

"Nickolai Dobrynin" <[email protected]> Mon, 6 Mar 2006 21:23:53 -0600
Newsgroups gmane.comp.scigraphica.gtkextra
Message-ID <[email protected]>
Dear all,

I seem to experience sporadic crashes in my application. They always happen
on shutdown, and, according to valgrind,
the following code from gtkplotcanvasplot.c triggers a memory access
violation:

static void gtk_plot_canvas_plot_destroy(GtkObject *object)
{
  GtkWidget *widget = GTK_WIDGET(GTK_PLOT_CANVAS_PLOT(object)->plot);
  gtk_widget_unref(widget);
  widget->parent = NULL; /* Is this legal? */
}

My question is: is the line that reads "widget->parent = NULL;" legal, given
that we had previously deallocated the
memory behind 'widget'?  Isn't this something that is likely to cause
crash?  The error message I get from valgrind
is "Invalid write of size 4", and it references that particular line I just
mentioned.  Any ideas?



Regards,

Nickolai