GNOME Bugzilla – Bug 110485
gtkcurve seg-fault on gtk_curve_set_curve_type
Last modified: 2004-12-22 21:47:04 UTC
when calling gtk_curve_set_curve_type( GTK_CURVE(curve), GTK_CURVE_TYPE_XXX) on a widget that hasn't been realized yet a seg-fault occurs. this is known to happen in 2.0 on an out of the box RH8.0 install and on a locally build 2.2.1. the problem doesn't seem to be corrected in the cvs HEAD. (should occur on any system) example code to exercsize bug: GtkWidget * curve; curve = gtk_curve_new(); gtk_curve_set_curve_type( GTK_CURVE(curve), GTK_CURVE_TYPE_LINEAR); in the process of changing c->curve_type several operations are completed on the GtkCurve object that seem to assume that it has been realized. namely a g_malloc is called on the width of the widget (which is -5 at the time) which causes a failure to allocate memory. the correction is rather simple and will be attached (as a patch) to this bug.
Created attachment 15620 [details] [review] patch that at least avoids the seg-fault. don't know how valid the state is though
Trying to fix doing-stuff-to-GtkCurve-before-realization would require a thorough examination of the code base and a lot of testing. GtkCurve is probably not something you want to use anyways. :-) *** This bug has been marked as a duplicate of 57012 ***