# HG changeset patch # User Pantxo Diribarne # Date 1441646909 -7200 # Node ID 79eb0746b21f9063d97e8362217ce72a72aebbe2 # Parent 76f67400649eb5eec8e84801483ee0bc63fd695d Fix segfault when hovering a Qt figure while it's being drawn (bug #45540) * Canvas.cc (Canvas::canvasMouseMoveEvent): ensure the QtHandles::Figure object is built from a figure object and is non null * Canvas.cc (Canvas::canvasMouseMoveEvent): add a FIXME note diff -r 76f67400649e -r 79eb0746b21f libgui/graphics/Canvas.cc --- a/libgui/graphics/Canvas.cc Fri Sep 25 21:00:29 2015 -0700 +++ b/libgui/graphics/Canvas.cc Mon Sep 07 19:28:29 2015 +0200 @@ -524,19 +524,24 @@ } // Update mouse coordinates in the figure window status bar - graphics_object obj = gh_manager::get_object (m_handle); + graphics_object figObj = + gh_manager::get_object (m_handle).get_ancestor ("figure"); - if (obj.valid_object ()) + if (figObj.valid_object ()) { graphics_object currentObj, axesObj; - select_object (obj, event, currentObj, axesObj, true); + select_object (figObj, event, currentObj, axesObj, true); if (axesObj.valid_object ()) { + // FIXME: should we use signal/slot mechanism instead of + // directly calling parent fig methods Figure* fig = - dynamic_cast (Backend::toolkitObject (obj)); + dynamic_cast (Backend::toolkitObject (figObj)); axes::properties& ap = Utils::properties (axesObj); - fig->updateStatusBar (ap.pixel2coord (event->x (), event->y ())); + + if (fig) + fig->updateStatusBar (ap.pixel2coord (event->x (), event->y ())); } } }