XForms: Re: Canvas in 0.87 + Folders

Michael Steliaros (ms@dcs.warwick.ac.uk)
Tue, 19 Aug 1997 12:13:10 +0100

To subscribers of the xforms list from Michael Steliaros <ms@dcs.warwick.ac.uk> :

Dr. T.C. Zhao wrote:

> >I use fl_modify_canvas_prop to add initialisation hooks. The
[...]
> >The cleanup part never gets called (same for 0.81; is this a
> >"feature"?).
[...]
> cleanup function only gets called when canvas or
> form is destroyed, and as far as I can tell, this
^^^^^^^^^
> works fine.

I assume that by destroyed you mean fl_free_form... The procedure I've
always used to destroy a form has been:

fl_hide_form(form->MAIN_FORM);
fl_free_form(form->MAIN_FORM);
fl_free(form);

I've always assumed that fl_free_form will free memory for _all_ objects
attached to it including calling any cleanup routines (as would be the
case for a canvas). Is this incorrect?

On a different note, I'm having some trouble with tabbed folders.
Following the same thinking, freeing the form containing the folder
should free the memory associated with the tabs (but not the FD_XXX
structure. Am I correct in thinking that the following is valid?

void popup_tabbed_demo(void)
{
FD_main *form_main = create_form_main();
FD_tab_a *form_tab_a = create_form_tab_a();
FD_tab_b *form_tab_b = create_form_tab_b();
FD_tab_c *form_tab_c = create_form_tab_c();
FL_OBJECT *obj;

fl_addto_tabfolder(form_main->tab, "A", form_tab_a->tab_a);
fl_addto_tabfolder(form_main->tab, "B", form_tab_b->tab_b);
fl_addto_tabfolder(form_main->tab, "C", form_tab_c->tab_c);

fl_show_form(form_main->main, FL_PLACE_CENTER, FL_TRANSIENT, "demo");

do{
obj = fl_do_forms();
}while(obj != form_main->done);

fl_hide_form(form_main->main);
fl_free_form(form_main->main);
fl_free(form_main);
fl_free(form_tab_a);
fl_free(form_tab_b);
fl_free(form_tab_c);
}

I have a requester that follows a similar procedure. It works fine first
time round but second time round it dies with:

X Error of failed request: BadColor (invalid Colormap parameter)
Major opcode of failed request: 1 (X_CreateWindow)
Resource id in failed request: 0x4400007
Serial number of failed request: 3745
Current serial number in output stream: 3756

In fact the behaviour is the same if _any_ other popup requester is
called immediately after the tabbed one closes. And no, there are no
canvases in the popup...

Any suggestions?

Mike
_________________________________________________________________
Michael K. Steliaros / ms@dcs.warwick.ac.uk
Computer Science Department, / http://www.dcs.warwick.ac.uk/~ms/
University of Warwick, / Tel: +44 1203 522417
Coventry CV4 7AL, UK. / Fax: +44 1203 525714
_________________________________________________
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/