diff --git a/src/motif/control.cpp b/src/motif/control.cpp index 310c2c6861..6413b92103 100644 --- a/src/motif/control.cpp +++ b/src/motif/control.cpp @@ -66,12 +66,8 @@ wxControl::~wxControl() { // If we delete an item, we should initialize the parent panel, // because it could now be invalid. - wxPanel *panel = wxDynamicCast(GetParent(), wxPanel); - if (panel) - { - if ( (wxControl *)panel->GetDefaultItem() == this) - panel->SetDefaultItem((wxButton*) NULL); - } + if ( GetParent()->panel->GetDefaultItem() == this) + panel->SetDefaultItem(NULL); } void wxControl::SetLabel(const wxString& label)