On Tue, Mar 4, 2014 at 10:43 PM, Chris Moller <mol...@mollerware.com> wrote:

> Okay, I'm out of ideas...
>
> I'm writing an app, that among a lot of other stuff, has three mutually
> interacting spinbuttuns, i.e., if I increment spinbutton A, its callback
> then updates values in B and C.  B and then would try to update A, and C,
> etc., resulting in a bottomless recursion.  So, what I need to do is, while
> I'm in A's callback, block the B and C callbacks; while in in B, block A
> and C and so on.
>
> Every combination of g_signal_handler_block(), 
> g_signal_handlers_block_matched(),
> etc, I've tried just results in seg faults--all that stuff works fine
> outside the callbacks, but the moment I stick them in a callback, death
> happens.
>
> Any suggestions?
>

I'm surprised g_signal_handler_block() or g_signal_stop_emission() didn't
work. This was actually a concern when we added the GBinding code to
GObject - making sure that these kinds of signal loops were well documented
and that you have to prevent against them yourself using one of these
methods.

My first suggestion would be to post a minimal test case demonstrating how
this failed for you - might have stepped on a bug, but either way it'd make
it easier to see why it failed for you.

My second suggestion is along the same line as Tristan's suggestion: create
a GObject that holds the value as a property (the model), and bind the
property to the views instead of binding the views' values together. (I
think this object would be more boilerplate than code, woe is our lives as
Gtk+ C developers.) You can use the GBinding code with an appropriate
GBindingTransformFunc applied to scale the value correctly for each view,
which cuts down the amount of code this approach would take. If these
controls are in the same place in the UI, you could bake it all (the three
spin buttons, any labels, and the one true value property) into one
composite GtkWidget and save yourself a bit of boilerplate too.

-A. Walton


> Thanks.
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to