Mercurial > octave-nkf
diff libinterp/interpfcn/octave-link.cc @ 16421:40d1ddca4db5
improve use of octave_link
* octave-link.h, octave-link.cc (octave_link::connect_link): Rename
from octave_link::connect. Change all uses. Allow link to be
disconnected. Don't add object to singleton_cleanup_list.
* main-window.h, main-window.cc (main_window::_octave_qt_link):
New data member.
(main_window::construct): Initialize it.
(main_window::~main_window): Disconnect octave_link and delete
_octave_qt_link.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 03 Apr 2013 23:35:33 -0400 |
parents | 81ec95768520 |
children | 919796a440c6 |
line wrap: on
line diff
--- a/libinterp/interpfcn/octave-link.cc Wed Apr 03 23:16:37 2013 -0400 +++ b/libinterp/interpfcn/octave-link.cc Wed Apr 03 23:35:33 2013 -0400 @@ -64,18 +64,17 @@ octave_exit = octave_exit_hook; } -// OBJ should be a new object of a class that is derived from -// the base class octave_link. It will be cleaned up by octave_link. +// OBJ should be an object of a class that is derived from the base +// class octave_link, or 0 to disconnect the link. It is the +// responsibility of the caller to delete obj. void -octave_link::connect (octave_link* obj) +octave_link::connect_link (octave_link* obj) { - if (instance) + if (obj && instance) ::error ("octave_link is already linked!"); else instance = obj; - - singleton_cleanup_list::add (cleanup_instance); } void