Frederic Bouvier wrote:
> David Luff wrote:
> > >One thing is that you can send me the exact procedure to trigger the
bug.
> >
> > Click on 'ATC/AI' on the menubar.  Click on 'frequencies' on the
resultant
> > menu.  Enter an identifier eg. ksfo, or any string of letters (it should
> > handle un-found airports).  Click on 'OK'.  Click on 'OK' again when the
> > frequencies get displayed.  This seems to crash it more often than not.
> > Clicking on 'Cancel' doesn't seem to crash it.
>
> I don't know PUI very well, but as far as I can see, you are deleting
> windows inside the OK button callback, that seems wrong in every
> GUI system I've seen so far.
>
> You should find a way to postpone the deletion after the mouseClick
> event is totally processed. I just looked at the property picker and
> the window is not deleted, just hidden with FG_POP_PUI_DIALOG.
>
> Perhaps you could consider constructing windows only once and reuse the
> same pointer every time.

Looking at your patch ...
I see you removed the deletion, but you are still allocating memory
every time we display the dialog, causing a memory leak.

Why not surrendering the first puiDialog creation by :

if ( !atcFreqDialog )
{
   atcFreqDialog = new puiDialog ...
   ...
   FG_FINALIZE_PUI_DIALOG(atcFreqDialog);
}

and doing that for the second one that is changing every time :

if ( atcFreqDisplay )
  delete atcFreqDisplay;

atcFreqDisplay = new puiDialog ...

...

? Of course, you can do this for both.

-Fred

PS : One more nit ;-) : for atcFreqDisplay, buttons only close the
window so there is 1 button more than needed.



_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to