From: Thomas Geymayer Date: Sun, 20 Jul 2014 21:31:32 +0000 (+0200) Subject: canvas::NasalWidget: check for empty setGeometry callback. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=726a4c6d10b786ceb11628107abbaab981b22c91;p=simgear.git canvas::NasalWidget: check for empty setGeometry callback. --- diff --git a/simgear/canvas/layout/NasalWidget.cxx b/simgear/canvas/layout/NasalWidget.cxx index d3feb9b4..9d31a455 100644 --- a/simgear/canvas/layout/NasalWidget.cxx +++ b/simgear/canvas/layout/NasalWidget.cxx @@ -19,6 +19,7 @@ #include "NasalWidget.hxx" #include +#include #include namespace simgear @@ -56,13 +57,17 @@ namespace canvas void NasalWidget::setGeometry(const SGRect& geom) { if( _geometry != geom ) + { _geometry = geom; - else if( !(_flags & LAYOUT_DIRTY) || !_set_geometry ) + _flags |= LAYOUT_DIRTY; + } + + if( !_set_geometry || !(_flags & LAYOUT_DIRTY) ) return; - naContext c = naNewContext(); try { + nasal::Context c; _set_geometry(nasal::to_nasal(c, this), geom); _flags &= ~LAYOUT_DIRTY; } @@ -74,7 +79,6 @@ namespace canvas "NasalWidget::setGeometry: callback error: '" << ex.what() << "'" ); } - naFreeContext(c); } //----------------------------------------------------------------------------