Weird behavior with mislocked: oct-file is unloaded while checking lock state...

Michael Goffioul michael.goffioul at gmail.com
Mon Sep 1 10:34:09 CDT 2008


Hi,

While still trying to lock FLTK backend code when it is loaded (to avoid
crash on "clear -f"), I added the following in __init_fltk__:

    octave_call_stack::top()->lock();

Then I use the following test code:

   backend('fltk');  <-- this calls __init_fltk__
   mislocked('__init_fltk__')

After that, I noticed that the backend behave strangely, especially
the fact that one bool static variable contained in fltk_backend.oct
was reset to false (while __init_fltk__ set it to true). After debugging,
I ended up in out_of_date_check_internal (symtab.cc) around line 208

		  if (file.empty ())
		    {
		      // Can't see this function from current
		      // directory, so we should clear it.

		      function = octave_value ();
		    }

After this piece of code, the module fltk_backend.oct is unmapped
from memory, losing the value of the internal static variable. Later on,
I guess the module is reloaded again and the static variable gets its
default value. I found this weird as __init_fltk__ is locked, so I had hoped
this would prevent unloading fltk_backend.oct.

I'm a little bit confused about this. John, could you give me a hint?

Michael.


More information about the Octave-maintainers mailing list