[From nobody Wed Dec  3 12:06:34 2008
X-From-Line: laurent.fournier@lapp.in2p3.fr Thu Mar  4 11:40:14 2004
Return-Path: &lt;laurent.fournier@lapp.in2p3.fr&gt;
Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78])
	by fantomas.inria.fr (8.11.1/8.11.1) with ESMTP id i24AeEj29518
	for &lt;lasgoutt@preval-mail.inria.fr&gt;;
	Thu, 4 Mar 2004 11:40:14 +0100 (MET)
Received: from lappa0.in2p3.fr (lappa0.in2p3.fr [134.158.96.113])
	by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i24AePIq015752
	for &lt;Jean-Marc.Lasgouttes@inria.fr&gt;; Thu, 4 Mar 2004 11:40:25 +0100
Received: from lapp.in2p3.fr (lappc-ad9.in2p3.fr [134.158.97.60])
	by lappa0.in2p3.fr (8.9.1/8.9.1) with ESMTP id LAA05956
	for &lt;Jean-Marc.Lasgouttes@inria.fr&gt;;
	Thu, 4 Mar 2004 11:40:13 +0100 (MET)
Message-ID: &lt;404707F2.2070306@lapp.in2p3.fr&gt;
Date: Thu, 04 Mar 2004 11:41:54 +0100
From: Laurent Fournier &lt;laurent.fournier@lapp.in2p3.fr&gt;
User-Agent: Mozilla/5.0 (Windows; U; Win98; fr-FR; rv:1.0.1) Gecko/20020823
	Netscape/7.0
X-Accept-Language: fr-fr, fr
To: Jean-Marc.Lasgouttes@inria.fr
Subject: Xforms : popup menus
X-Miltered: at nez-perce by Joe's j-chkmail (&quot;http://j-chkmail.ensmp.fr&quot;)!
Lines: 71
Xref: fantomas.inria.fr perso:21568
MIME-Version: 1.0

Dear Jean-Marc,

I will try to give you some more information on how I use Xforms and how 
I discovered this bug.
*** My application is a bit complicated :
It is a graphical client which can manage as many servers as the user 
configures them in a configuration file.
The clients connects to the servers giving the user all control on them. 
The servers send (typically) every second their state which is reported 
in the proper text box.
- it has to run 24hour a day, 365 days a year (it is used on the Virgo 
experiment in Italy).
- it has to handle several sources of external data (X, of course, 
TCP/IP data coming from the &quot;Cm&quot; package, and piped data when forking 
processes to be reported in a browser). All that stuff is handled 
through Cm (no other way !) and reliability could be achieved only by 
having ONE select() call in the whole application.
- the data flow is asynchronous on every source.
- many menus are user-defined through the means of a configuration file, 
and I added context-sensitive menus (right mouse button) by using 
extensively the preemptive handlers on objects and raw callbacks on forms.
- form resizing is completely overriden by means of &quot;resizing callbacks&quot; 
which are called to resize or move every single object in a form and 
every form can be either X-only, Y-only or X-and-Y resizable.
- modal forms are available without affecting the whole dataflow
- some other &quot;dirty tricks&quot; are used through the whole application such 
as pre- and post-.handlers...

*** The context of using the menus of Xforms.
The first steps of development  were to use menus (not directly popups) 
because there was no need for cascaded menus. I got crashes some times 
when exiting from a menu (with or without selection) but I did not 
compile on LynxOS... then I could not find the reason of the problem.
When came the need of cascaded menus, then I used directly popups, with 
the PopupEntry structure. The data is made of a fixed part and a 
variable part coming from the configuration file. Things became worse ! 
I then turned myself towards LynxOS which I know to be very sensitive to 
memory corruptions (we use real-time CPUs for data acquisition which is 
also a big part of my job). In a few hours I got several segmentation 
violations and I discovered the following :
When calling fl_freepup(), there is a loop which frees all menu items by 
looping on ALL entries (it is limited to FL_MAXPUPI, not nitems) but the 
data is not set to 0. This is the reason why I replaced all settings to 
0 in the initialization routine by a single memset() (which is portable 
on almost every OS) and I have done the same when setting the maximum 
number of popups (fl_setpup_maxpup()) because realloc() does not set the 
data to 0. The call to memset() should not affect speed as it is only 
called at initialization time. When calling fl_safe_free(), the NULL 
pointers are obviously not freed and everything works fine.
I sometimes had the problem reported in the forum but I did not 
experience the problem since this correction. The current patched 
version is not released yet to users and I do not have enough feedback 
from the users.
Besides this, one major improvement to popups would be not to use a 
&quot;maxpup&quot; value but to have automatic reallocation, when needed. My 
application stores much more than 64 menus but the number of menus is 
not known by advance...

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

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

Cordialement,
Laurent FOURNIER.



]