octave-maintainers
[Top][All Lists]
Advanced

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

Approach to error() and gh_manager::unlock ()?


From: Rik
Subject: Approach to error() and gh_manager::unlock ()?
Date: Mon, 21 Dec 2015 09:50:17 -0800

12/21/15

All,

In graphics.cc it appears that there are some conflicts between the new
exception based error code and the lock code for gh_manager.  See the code
below.

-- graphics.cc:10808 --
if (args.length () == 1)
  {
    caseless_str val (args(0).xstring_value ("drawnow: first argument must
be a string"));

    if (val.compare ("expose"))
      do_events = false;
    else
    {
      gh_manager::unlock ();

      error ("drawnow: invalid argument, 'expose' is only valid option");
    }
  }
-- End Code --

It appears that the code desires to release the lock it has before issuing
an error.  But this won't necessarily happen because the xstring_value()
call will directly call error () if the first argument is not a string. 
There are only 10 instances of gh_manager::unlock in graphics.cc so am
asking for someone familiar with that code to review each instance and see
if the input validation needs to be recoded.  In this case, the first test
might be written as

-- New Code --
if (! args(0).is_string ())
{
  gh_manager::unlock ();

  error ("drawnow: first argument must be a string");
}

caseless_str val = args(0).string_value ();
-- End Code --

Thanks,
Rik




reply via email to

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