Author Topic: Console "Sandbox ?" >> PixInsight aplication crash  (Read 3154 times)

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Console "Sandbox ?" >> PixInsight aplication crash
« on: 2011 September 18 10:32:18 »
Hello Juan.
Take the Bug. PI 1.7 Win7_32&64 throw; doesn't work properly.  ;)

Sandbox bad code:
Code: [Select]
Console().WriteLn( "No view(s) found: " + arg.Token() );
throw;

My solution : throw Error ( "No view(s) found: " + arg.Token() );

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Console "Sandbox ?" >> PixInsight aplication crash
« Reply #1 on: 2011 September 18 10:57:27 »
Hi Nikolay,

As far as I understand it, there is no bug here. The statement:

throw;

(throw without arguments) can only be used inside a catch block to re-throw an already thrown (and catched) exception. For example:

try
{
   // some code that throws an exception
   throw "foo";
}
catch ( ... ) // catch any exception
{
   std::cout << "I've caught something, but I don't bother to know what it is at this point...\n";
   throw; // re-throw the exception
}


When you re-throw an exception as above, it is forwarded to an outer try/catch level, if it exists, or otherwise it is treated as a regular uncaught exception.

So you can't use throw; out of the scope of a catch construct.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Console "Sandbox ?" >> PixInsight aplication crash
« Reply #2 on: 2011 September 18 19:07:30 »
no bug here.
Juan, just try execute in console the simple command: Sandbox ?
« Last Edit: 2011 September 18 20:28:16 by NKV »

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Console "Sandbox ?" >> PixInsight aplication crash
« Reply #3 on: 2011 September 18 23:57:23 »
Ahhh! Now I understand. Thank you for catching this bug (line 215 of SandboxProcess.cpp). Your fix is of course correct; I'll publish a bugfix update soon.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/