Mercurial > octave-nkf
comparison libgui/graphics/Canvas.cc @ 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 | 2d415c68213f |
children | 3aea4200da40 |
comparison
equal
deleted
inserted
replaced
20550:76f67400649e | 20551:79eb0746b21f |
---|---|
522 "windowbuttonmotionfcn"); | 522 "windowbuttonmotionfcn"); |
523 } | 523 } |
524 } | 524 } |
525 | 525 |
526 // Update mouse coordinates in the figure window status bar | 526 // Update mouse coordinates in the figure window status bar |
527 graphics_object obj = gh_manager::get_object (m_handle); | 527 graphics_object figObj = |
528 | 528 gh_manager::get_object (m_handle).get_ancestor ("figure"); |
529 if (obj.valid_object ()) | 529 |
530 if (figObj.valid_object ()) | |
530 { | 531 { |
531 graphics_object currentObj, axesObj; | 532 graphics_object currentObj, axesObj; |
532 select_object (obj, event, currentObj, axesObj, true); | 533 select_object (figObj, event, currentObj, axesObj, true); |
533 | 534 |
534 if (axesObj.valid_object ()) | 535 if (axesObj.valid_object ()) |
535 { | 536 { |
537 // FIXME: should we use signal/slot mechanism instead of | |
538 // directly calling parent fig methods | |
536 Figure* fig = | 539 Figure* fig = |
537 dynamic_cast<Figure*> (Backend::toolkitObject (obj)); | 540 dynamic_cast<Figure*> (Backend::toolkitObject (figObj)); |
538 axes::properties& ap = Utils::properties<axes> (axesObj); | 541 axes::properties& ap = Utils::properties<axes> (axesObj); |
539 fig->updateStatusBar (ap.pixel2coord (event->x (), event->y ())); | 542 |
543 if (fig) | |
544 fig->updateStatusBar (ap.pixel2coord (event->x (), event->y ())); | |
540 } | 545 } |
541 } | 546 } |
542 } | 547 } |
543 | 548 |
544 void | 549 void |