[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RFH: drawxtl seg-faulting (#853829)



On Mon, 2019-12-23 at 00:58 +0100, Daniel Leidert wrote:
> Hi,
> 
> I'm in need of assistance to fix #853829. The issue is that drawxtl segfaults
> on exit. The offending lines are 350 and/or 356 (and similar) in
> source/DRAWxtl55/CrystalView.cxx. I get the gut feeling that calling the
> delete() function on the Fl_Window objects (Configure->ConfigWindow), for which
> the destructor (~Fl_Window()) already has been called, might be the issue here:
> 
> >      if (Configure) {
> >         Configure->ConfigWindow->~Fl_Window ();
> >         delete (Configure->ConfigWindow);
> >         delete (Configure);
> >         Configure = NULL;
> > 
> 
> But I'm not experienced with FLTK and I even cannot find a description of the
> delete() function to judge,

That's because delete is an operator, not a function.

> if this method is safe or unsafe to call here. If
> I'm right, the fix is as easy as commenting out the relevant delete() calls.
> 
> Any help is appreciated.

If Configure->ConfigWindow has been allocated with the new operator,
the direct call to the destructor is wrong and the delete is correct.

If it has been allocated in some unusual way, then the direct call to
the destructor is probably correct and the delete is wrong.

Ben.

-- 
Ben Hutchings
Lowery's Law:
        If it jams, force it. If it breaks, it needed replacing anyway.


Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: