Re: Problems deleting vscale/hscale with gtk_widget_destroy()



Hi David,
David Topper wrote:
I have an app which creates a "fancy" slider using vscale. Basically, I have the vscale packed into a box, then into a frame. Alongside the scale are text digits to provide the user with a scale. But when I issue:

   gtk_widget_destroy(frame);

I get a host of errors / warnings:

I had a similar problem with a gtk1.2 app I did. My problem was I occasionally had to destroy the widget from the value_changed callback, causing huge confusion, since gtkscale has a timeout it does not remove in destroy. There's a bug filed on this, but i think there's not going to be another gtk1.2, so it's unlikely to be fixed.

My (very ugly) solution was to catch the "destroy" signal for the scale and do a gtk_object_ref() to stop it being freed. I then had a thing in the idle loop which spotted the zombie scales and _unref()ed them.
Here's my slider-with-a-text-box widget. It does log scales and stuff too:

 http://cima.ng-london.org.uk/~john/tslider.h
 http://cima.ng-london.org.uk/~john/tslider.c

You can see it here:

 http://www.vips.ecs.soton.ac.uk/snap.jpg

The sliders with the text box to their left, down the left side of the screen.

John



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