]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/listbox.cpp
Further fixes to references
[wxWidgets.git] / src / gtk1 / listbox.cpp
index d54e30e3245bfb66ec9ed2123a5b5f28fde577ef..afdac346504226cb169136cc376f4a1eca99c17f 100644 (file)
@@ -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;