diff --git a/src/osgUI/PushButton.cpp b/src/osgUI/PushButton.cpp index 4b70d17b8..cb83961ae 100644 --- a/src/osgUI/PushButton.cpp +++ b/src/osgUI/PushButton.cpp @@ -106,10 +106,12 @@ void PushButton::createGraphicsImplementation() // create label. osg::ref_ptr node = style->createText(extents, getAlignmentSettings(), getTextSettings(), _text); - _textDrawable = dynamic_cast(node.get()); - _textDrawable->setDataVariance(osg::Object::DYNAMIC); - group->addChild(_textDrawable.get()); + _textDrawable = dynamic_cast(node.get()); + + node->setDataVariance(osg::Object::DYNAMIC); + + group->addChild(node.get()); style->setupClipStateSet(_extents, getOrCreateWidgetStateSet());