diff libgui/graphics/Canvas.cc @ 24672:13c207835e79

Rethrow gl2ps_print exceptions from GUI to interpreter thread (bug #50198) * Canvas.cc (Canvas::print): Catch gl2ps_print execution exceptions and post them to the interpreter event queue. * octave-link.h (octave_link::post_exception, octave_link::post_exception, octave_link::rethrow_exception_callback): New methods.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 30 Jan 2018 23:58:48 +0100
parents 9d01ce02d5cb
children f7e333b12687
line wrap: on
line diff
--- a/libgui/graphics/Canvas.cc	Thu Feb 01 21:06:57 2018 -0800
+++ b/libgui/graphics/Canvas.cc	Tue Jan 30 23:58:48 2018 +0100
@@ -110,8 +110,15 @@
     if (obj.valid_object ())
       {
         graphics_object figObj (obj.get_ancestor ("figure"));
-
-        octave::gl2ps_print (figObj, file_cmd.toStdString (), term.toStdString ());
+        try
+          {
+            octave::gl2ps_print (figObj, file_cmd.toStdString (),
+                                 term.toStdString ());
+          }
+        catch (octave::execution_exception e)
+          {
+            octave_link::post_exception (std::current_exception ());
+          }
       }
   }
 
@@ -638,7 +645,7 @@
           currentObj = figObj;
         else if (! currentObj.get_properties ().is_hittest ())
           {
-            // Objects with "hittest"->"off" pass the mouse event to their 
+            // Objects with "hittest"->"off" pass the mouse event to their
             // parent and so on.
             graphics_object tmpgo;
             tmpgo = gh_manager::get_object (currentObj.get_parent ());
@@ -674,7 +681,7 @@
               // Update the figure "currentobject"
               auto& fprop = Utils::properties<figure> (figObj);
 
-              if (currentObj 
+              if (currentObj
                   && currentObj.get_properties ().handlevisibility_is ("on"))
                 fprop.set_currentobject (currentObj.get_handle ()
                                          .as_octave_value ());