PATCH: kdelibs/kdeui/ktoolbarbutton.cpp

Simon Hausmann hausmann at kde.org
Mon Nov 10 12:52:32 GMT 2003


On Sat, Nov 08, 2003 at 07:18:41PM +0100, Martin Pley wrote:
> Patch below fixes a crash when using KToolBarButton with parent != KToolBar
> 
> If it's okay as it is, I'll commit.
[...]
>+  if (_parent && _parent->inherits("KToolBar") ) {
>+    d->m_parent = dynamic_cast<KToolBar*>(_parent);
>+    connect(d->m_parent, SIGNAL( modechange() ),
>+            this,         SLOT( modeChange() ));
>+  }

That's probably simpler (and faster) expressed as:

d->m_parent = dynamic_cast<KToolBar *>( _parent );
if ( d->m_parent )
    connect( .... );


Simon




More information about the kde-core-devel mailing list