Mercurial > octave-nkf
changeset 20551:79eb0746b21f
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
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Mon, 07 Sep 2015 19:28:29 +0200 |
parents | 76f67400649e |
children | 4479d73eac72 |
files | libgui/graphics/Canvas.cc |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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<Figure*> (Backend::toolkitObject (obj)); + dynamic_cast<Figure*> (Backend::toolkitObject (figObj)); axes::properties& ap = Utils::properties<axes> (axesObj); - fig->updateStatusBar (ap.pixel2coord (event->x (), event->y ())); + + if (fig) + fig->updateStatusBar (ap.pixel2coord (event->x (), event->y ())); } } }