Re: XForms: Segmentation Fault using xyplot

From: Steve Lamont (spl@blinky.ucsd.edu)
Date: Sun Jun 04 2000 - 15:16:08 EDT

  • Next message: Jean-Marc Lasgouttes: "XForms: [Michael Schmitt <schmitt@itm.mu-luebeck.de>] Sorry, guys - Purify report"

    # To subscribers of the xforms list from Steve Lamont <spl@blinky.ucsd.edu> :

    > fl_show_form(fd_interface->interface,FL_PLACE_CENTERFREE,FL_FULLBORDER,"Cont
    > role PID de um duplo integrador ");
    >
    > do{
    > fl_set_xyplot_data(fd_interface->Posicao,(void *) 1, (void *) 1,
    > 1,"Title","Eixo X","Eixo Y");
    >
    > }while(1);

    This doesn't make a lot of sense to me. The fl_set_xyplot_data()
    function takes as its second and third arguments a pointer to array of
    float. What you've coded, `(void *) 1', is casting the value 1 to a
    pointer to void, which the compiler will happily accept but this
    do doubt points to invalid data.

    What you probably want to do is something like

            float x[] = { 1 };
            float y[] = { 1 };

            fl_set_xyplot_data(fd_interface->Posicao, x, y, 1, ... );

    Another thing that doesn't make sense is that you're setting the data
    for your xyplot an infinite number of times with the

            do {
                    ...
            } while ( 1 );

    construction. Unless this is some sort of placeholder for real code,
    this is probably not what you want to do.

    Finally, you're not calling the XForms main loop with fl_do_forms() or
    fl_check_forms(). This will probably result in objects not being
    updated or, in some cases, not even being shown. Most XForms function
    calls merely set fields in internal data structures but do not cause
    anything to be redrawn until the main loop executes, either
    explicitly, by calling fl_check_forms()[1] or by returning from a
    callback (which is called from the main loop within fl_do_forms()).

    Hope this makes sense.

                                                            spl

    [1] Okay, so fl_check_forms() isn't really a loop, but it's a pass
    through the "business end" of the main loop which returns immediately,
    but the effect is the same. Sort of.
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/



    This archive was generated by hypermail 2b29 : Sun Jun 04 2000 - 15:21:06 EDT