Re: XForms: problems with fl_get_choice_text

Bjoern Fuerst (fuerst@kph.uni-mainz.de)
Wed, 05 Nov 1997 18:56:26 +0100 (CET)

To subscribers of the xforms list from Bjoern Fuerst <fuerst@kph.uni-mainz.de> :

On 05-Nov-97 Steve Lamont wrote:

>I suspect the source of your problem is trying to do *anything* other
>than set a flag from within a signal handler. Making Xlib calls (or
>XForms calls, which are merely sophisticated wrappers around Xlib
>calls) is the Kiss of Death[tm]. X is not reentrant and making an X
>call from an interrupted X call will cause the sort of bogosity you
>experience.
>
>You can do the same thing by either using an idle callback (see
>fl_idle_callback() and fl_set_idle_delta()), by using a timeout
>(fl_add_timeout()), or by registering a signal handler
>(fl_add_signal_callback()).
>
>I list those in more or less my own order of preference. I'd probably
>use the idle callback if I had no other idle tasks I needed to perform
>in the application.
>
> spl

Thank you for the quick (and understandable!) answer Steve,

i changed the code as you said to the following:


int redraw() !! nothing important changed here !!
{
sscanf((char *)datum(),"%*s %s %d %s %d",monat,&tag,time_string,&jahr);
sscanf((char *)time_string,"%d:%d:%d", &stunde_start, &minute_start, &sekunde
_start);
monat_int=make_month(monat);

printf("Pointer-Value: %d\n",MainForm->dimension_choice);

calculate(julian(tag,monat_int,jahr),
julian(17,12,1997),
stunde_start, minute_start, sekunde_start,
11, 25, 00,
(char *)fl_get_choice_text(MainForm->dimension_choice),
(char *)output);

fl_hide_object(MainForm->output_field);
fl_set_object_label(MainForm->output_field,output);
fl_show_object(MainForm->output_field);
return(0);

}

and in main():

fl_set_idle_callback(redraw,0);
fl_set_idle_delta(1000);
obj=fl_do_forms();

I hope that is what you meant, but I'm sorry to say that it still doesn't work.
But OK, I'm getting a little closer, at least I think so.

See, I added a line in redraw ():

printf("Pointer-Value: %d\n",MainForm->dimension_choice);

so what happens is just what I wrote in the first mail. Everything works fine.
Output all right, depending on the choices you make.
the printf outputs say a

134636775
134636775
>.
>.
>.

BUT

Touching a key on the active Window results in the mentioned segmentation fault
AND the last output of the printf was say

2

That's it! The program just lost the pointer, somewhere, somehow. I've got still
no idea what happens.

Perhaps I should say that I "made" the form using the fdesign and importing the
.h file while linking everything together with something like

all: ToGo

ToGo: ToGo.o ToGo_design.o Julian.o
@echo "Linking ToGo ... "
gcc $(GCCOPT) $(GCCLIB) -o ToGo ToGo.o ToGo_design.o Julian.o

I checked the demos that come with the XForms but none of them does it that way,
in these, everything is in the .c-file, could that be the point?

I'm sorry not be able to give more information, perhaps someone got some hints.

TIA

best regards

Bjoern

E-Mail: Bjoern Fuerst <fuerst@kph.uni-mainz.de>
Date: 05-Nov-97
Time: 18:56:28
-------------------------------------------------------------------------------
Bjoern Fuerst Proud Member of the WWW-A2-Team
A2 Collaboration Phone: ++49/6131/39-5899
Institut fuer Kernphysik Fax: ++49/6131/39-2964
Johannes Gutenberg Universitaet WWW: http://www.kph.uni-mainz.de/A2
Johann-Joachim-Becher Weg 45
D-55099 Mainz
Germany
-------------------------------------------------------------------------------
"Nice joke Scotty - now beam up my clothes"
-------------------------------------------------------------------------------
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/