diff libgui/graphics/Container.cc @ 22190:e68128601f5e

skip invalid objects in Qt graphics event handlers (bug #46501) * Container.cc (Container::resizeEvent): Avoid accessing properties from invalid graphics object. * Panel.cc (Panel::eventFilter): Likewise. * graphics.in.h (base_graphics_object:get_properties): Issue warning instead of error.
author John W. Eaton <jwe@octave.org>
date Thu, 28 Jul 2016 16:07:11 -0400
parents 2aef506f3fec
children bac0d6f07a3e
line wrap: on
line diff
--- a/libgui/graphics/Container.cc	Thu Jul 28 16:54:54 2016 +0200
+++ b/libgui/graphics/Container.cc	Thu Jul 28 16:07:11 2016 -0400
@@ -89,11 +89,16 @@
 
           if (obj)
             {
-              Matrix bb = obj->properties ().get_boundingbox (false);
+              graphics_object go = obj->object ();
 
-              obj->qWidget<QWidget> ()
-                ->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
-                               octave::math::round (bb(2)), octave::math::round (bb(3)));
+              if (go.valid_object ())
+                {
+                  Matrix bb = go.get_properties ().get_boundingbox (false);
+
+                  obj->qWidget<QWidget> ()
+                    ->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
+                                   octave::math::round (bb(2)), octave::math::round (bb(3)));
+                }
             }
         }
     }