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

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

[Octave-bug-tracker] [bug #61994] Crash on GUI exiting with octave_base_


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #61994] Crash on GUI exiting with octave_base_value objects still open.
Date: Thu, 17 Feb 2022 11:01:08 -0500 (EST)

Follow-up Comment #25, bug #61994 (project octave):

Please try the attached patch that attempts to implement option #2 from
comment #24.

At first, I thought that if I could just store a reference to the containing
dynamic library (audiodevinfo.oct) in the audioplayer and audiorecorder
classes (octave_base_value objects that are created by functions defined in
audiodevinfo.oct) that it would be sufficient.  But then it was still possible
to close the dynamic library from inside the audioplayer or audiorecorder
destructors that are defined inside the dynamic library.  Doing that is no
good and can result in a crash.  To avoid that, instead of allowing the
containing dynamic_library object to be deleted when the audioplayer or
audiorecorder objects go out of scope, the dynamic_library object is added to
a global list of dynamic_libraries that can be deleted later.  This action
just transfers ownership of the reference to the dynamic_library to the global
list.  Since the dynamic_library object is also reference counted, the library
won't really be closed until all references are deleted.  The global list of
to-be-deleted dynamic_library objects is periodically cleared by the
interpreter.  But because the list is global, it is not cleared when the
interpreter goes out of scope.  So it is now OK if the GUI thread is still
running and deletes the audioplayer object after the interpreter is done
because there is still a reference to the audiodevinfo.oct file in the global
list of to-be-deleted dynamic_library objects.  Then, finally, the list is
cleared and the dynamic_library objects are unloaded and deleted when the
destructors for global objects are called.

This change also removes the calls to mlock in the audiodevinfo.oct functions.
 So now it should be possible to unload that .oct file if and only if all
functions that it defines and octave_value objects created by it have been
cleared.

(file #52877)
    _______________________________________________________

Additional Item Attachment:

File name: dynlib-delete-later-diffs.txt  Size:30 KB
   
<https://file.savannah.gnu.org/file/dynlib-delete-later-diffs.txt?file_id=52877>



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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