X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b33c8d22ccc7f7d059c2d0daaa2a86f6e30e7315..81c9effa8462662263c3b4eac2cfae1ef5caae2c:/src/gtk1/listbox.cpp diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index d54e30e324..afdac34650 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -83,7 +83,13 @@ extern "C" gint wxlistbox_idle_callback( gpointer gdata ) gtk_idle_remove( data->m_tag ); - data->m_listbox->SetFirstItem( data->m_item ); + // check that the items haven't been deleted from the listbox since we had + // installed this callback + wxListBox *lbox = data->m_listbox; + if ( data->m_item < lbox->GetCount() ) + { + lbox->SetFirstItem( data->m_item ); + } delete data;