comparison libgui/graphics/Panel.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
comparison
equal deleted inserted replaced
22189:829e0aafebdc 22190:e68128601f5e
189 189
190 if (m->button () == Qt::RightButton) 190 if (m->button () == Qt::RightButton)
191 { 191 {
192 gh_manager::auto_lock lock; 192 gh_manager::auto_lock lock;
193 193
194 ContextMenu::executeAt (properties (), m->globalPos ()); 194 graphics_object go = object ();
195
196 if (go.valid_object ())
197 ContextMenu::executeAt (go.get_properties (),
198 m->globalPos ());
195 } 199 }
196 } 200 }
197 break; 201 break;
198 202
199 default: 203 default:
207 case QEvent::Resize: 211 case QEvent::Resize:
208 if (qWidget<QWidget> ()->isVisible ()) 212 if (qWidget<QWidget> ()->isVisible ())
209 { 213 {
210 gh_manager::auto_lock lock; 214 gh_manager::auto_lock lock;
211 215
212 properties ().update_boundingbox (); 216 graphics_object go = object ();
217
218 if (go.valid_object ())
219 go.get_properties ().update_boundingbox ();
213 } 220 }
214 break; 221 break;
215 222
216 default: 223 default:
217 break; 224 break;