[XForms] Lightbutton bug - Button causes app to crash.

Jens Thoms Toerring jt at toerring.de
Sat Apr 11 11:55:08 CEST 2009

To subscribers of the xforms list

Hi Dennis,

On Sat, Apr 11, 2009 at 06:49:43PM +0000, Dennis K wrote:
> the diffence between whether those buttons cause the app to crash, is
> wether something has been entered in the 'callback' secton of the
> attributes form.  No callback = program exit.  Callback = runs fine.

I don't think it's a bug what you are seeing here. In the
example program you have more or less this:

    fl_do_forms( );
    return 0;             /* end of program */

Now, fl_do_forms() isn't just an infinite loop. It returns
the address of the object when interaction with that object
happened - unless a callback function is installed for the
object. And I think that's what happens in your case: when
there's no callback for the button the fl_do_forms() func-
tion returns the address of the button's object and then the
program simply ends. If you install a callback for the button
fl_do_forms() does not return, so the program continues to
run. So if you don't use callbacks you should use something
like this

    while ( fl_do_form() != quit_button )
        /* empty ; */
    return 0;

in order to avoid ending the program until some "Quit"
button (object 'quit_button') has been clicked on. The
fdesign program can't do that for you since it simply
isn't clever enough to figure out which object might be
the "Quit" button (or if there's one at all or more than
one etc.), so it just puts in the call to fl_do_forms()
and relies on you to fill in the rest.

Does that make sense to you?

                        Best regards, Jens
  \   Jens Thoms Toerring  ________      jt at toerring.de
   \_______________________________      http://toerring.de
To unsubscribe, send any message to
xforms-leave at bob.usuhs.mil or see: 
List Archive: http://bob.usuhs.mil/pipermail/xforms and
XForms Home: http://savannah.nongnu.org/projects/xforms

More information about the Xforms mailing list