Re: XForms: fl_delete_object

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 2 Nov 99 07:59:07 PST

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> obj1=liste->fl_form->first;
> {
> while(obj1->next!=NULL)
> {
> obj2=obj1->next;
> fl_delete_object(obj1);
> fl_free_object(obj1);
> obj1=obj2;
> }
> }

The problem is that you're deleting the innards of the Browser object
after you've deleted the Browser itself. The Browser is a composite
object, made up of sliders, buttons, and a text box. Deleting the
Browser automagically deletes the children. Since the children are
deleted, the pointer `obj2' points to an already deleted object. I
admit that the error message is somewhat deceptive (TC?) but
dereferencing pointers to freed objects is not kosher, anyhow.

while(obj1=liste->fl_form->first)
{
fl_delete_object(obj1);
fl_free_object(obj1);
}

will do what you want (though why you'd want to delete every object in
a Form, I confess, baffles me entirely).

spl
_________________________________________________
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://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/