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

John W. Eaton jwe at bevo.che.wisc.edu
Tue Sep 2 14:13:14 CDT 2008


On  1-Sep-2008, Michael Goffioul wrote:

| 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?

Probably there should be a check here to ensure that FUNCTION is not
locked, and not clear it if it is locked.  Should we also warn here
about a locked function being out of date?

jwe


More information about the Octave-maintainers mailing list