octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #59228] embedded.cc example crashes with segfa


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #59228] embedded.cc example crashes with segfault
Date: Wed, 14 Oct 2020 13:07:30 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #23, bug #59228 (project octave):

Carlo: I think the problem is the way the singleton object is cleaned up in
your program.

The static object is not deleted until after main is finished executing.  At
that point, the destructor for the static octave_file_io_intf object is
called.  But also at that point, any memory allocated by new may have already
been reused.  So executing shutdown on the interpreter or calling delete may
fail because the interpreter shutdown function does a lot more than just
deleting memory.  Do you need to use a singleton or static objects?

If you like the convenience of the singleton object and still want to shutdown
the interpreter, you could make some changes like those in the attached patch.
 I left in some statements to trace execution if you want to trace what
happens with or without the new octave_io_cleanup function

Either way, I think you need to ensure that the interpreter is cleaned up
before main returns.

(file #49980)
    _______________________________________________________

Additional Item Attachment:

File name: diffs.txt                      Size:2 KB
    <https://file.savannah.gnu.org/file/diffs.txt?file_id=49980>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59228>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]