[XForms] Re: Xforms : popup menus

Jean-Marc Lasgouttes Jean-Marc.Lasgouttes at inria.fr
Wed Mar 31 05:51:23 EST 2004


>>>>> "Laurent" == Laurent Fournier <laurent.fournier at lapp.in2p3.fr> writes:

Dear Laurent,

Sorry for not answering earlier to your message. I wanted to take a
look at the code first. I'd like to settle this popup issue before
1.1.0, but I am somhow not satisfied with the solution of using memset
(why? I do not know precisely :)

Laurent> Dear Jean-Marc, I will try to give you some more information
Laurent> on how I use Xforms and how I discovered this bug. 
[snip]

Laurent> *** The context of using the menus of Xforms. The first steps
Laurent> of development were to use menus (not directly popups)
Laurent> because there was no need for cascaded menus. I got crashes
Laurent> some times when exiting from a menu (with or without
Laurent> selection) but I did not compile on LynxOS... then I could
Laurent> not find the reason of the problem. When came the need of
Laurent> cascaded menus, then I used directly popups, with the
Laurent> PopupEntry structure. The data is made of a fixed part and a
Laurent> variable part coming from the configuration file. Things
Laurent> became worse ! I then turned myself towards LynxOS which I
Laurent> know to be very sensitive to memory corruptions (we use
Laurent> real-time CPUs for data acquisition which is also a big part
Laurent> of my job). In a few hours I got several segmentation
Laurent> violations and I discovered the following : When calling
Laurent> fl_freepup(), there is a loop which frees all menu items by
Laurent> looping on ALL entries (it is limited to FL_MAXPUPI, not
Laurent> nitems) but the data is not set to 0. 

What particular data should have been set to zero and caused problem? 
At least the pointers are correctly reset. Was the problem related to
callbacks? 

Laurent> This is the reason why I replaced all settings to 0 in the
Laurent> initialization routine by a single memset() (which is
Laurent> portable on almost every OS) and I have done the same when
Laurent> setting the maximum number of popups (fl_setpup_maxpup())
Laurent> because realloc() does not set the data to 0. 
Laurent> The call to memset() should not affect speed as it is only
Laurent> called at initialization time. When calling fl_safe_free(),
Laurent> the NULL pointers are obviously not freed and everything
Laurent> works fine. 

I agree that memset is not expensive. I would just like to understand
where the real problem was, in order to be sure that we do not miss
something. 

Laurent> I sometimes had the problem reported in the forum but I did
Laurent> not experience the problem since this correction. The current
Laurent> patched version is not released yet to users and I do not
Laurent> have enough feedback from the users. Besides this, one major
Laurent> improvement to popups would be not to use a "maxpup" value
Laurent> but to have automatic reallocation, when needed. My
Laurent> application stores much more than 64 menus but the number of
Laurent> menus is not known by advance...

I am not sure whether automatic reallocation is really a good thing.
It may bite you if you have a popup leak (which may happen easily).

Laurent> Last but not least : could you please send me the exact web
Laurent> address when reading about Xforms and getting new releases ?
Laurent> I would be grateful to get the mails from the Xforms
Laurent> developers, as I feel now to have enough experience on the
Laurent> whole library.

The home of the xforms project is now: 
https://savannah.nongnu.org/projects/xforms

You will find in the Files section xforms 1.0.90, released yesterday
in preparation for 1.1.0. I would appreciate if you could test it with
the systems you have here (like lynxOS) since we have switched to a
new configuration scheme.

There is also a mailing list accessible from there:
http://cweblog.usuhs.mil/mailman/listinfo/xforms

Please use the list for further communication.

Laurent> I thank you very much for your attention. Please feel free to
Laurent> ask for more, if needed.

You're very welcome.

JMarc



More information about the Xforms mailing list