From 62139e5a277bf77eacadccedc70cf5216097dba9 Mon Sep 17 00:00:00 2001
From: Robin Dunn <robin@alldunn.com>
Date: Tue, 14 Mar 2006 22:00:17 +0000
Subject: [PATCH] Can't use IsValidInsert from GtkAddHelper as it could cause a
 segfault in GetCount if the widget is not fully created yet.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38078 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/gtk/choice.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp
index 80343f91c1..454348b569 100644
--- a/src/gtk/choice.cpp
+++ b/src/gtk/choice.cpp
@@ -485,7 +485,7 @@ void wxChoice::DoApplyWidgetStyle(GtkRcStyle *style)
 
 int wxChoice::GtkAddHelper(GtkWidget *menu, size_t pos, const wxString& item)
 {
-    wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
+    wxCHECK_MSG((pos>=0) && (pos<=(int)m_clientList.GetCount()), -1, wxT("invalid index"));
 
     GtkWidget *menu_item = gtk_menu_item_new_with_label( wxGTK_CONV( item ) );
 
-- 
2.47.2