]> git.saurik.com Git - wxWidgets.git/commitdiff
1. corrected uninitialised variable (which led to crash) in wxListBox
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 26 Oct 1999 13:54:58 +0000 (13:54 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 26 Oct 1999 13:54:58 +0000 (13:54 +0000)
2. corrected assert failures in wxChoiceDialog

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4198 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/choicdgg.h
src/generic/choicdgg.cpp
src/gtk/listbox.cpp
src/gtk1/listbox.cpp

index 553381b050a3c4ac8aae0aaab0c235e6759a10d2..7dbf48525ab792c55b44f52111438324bfbf7ab4 100644 (file)
@@ -64,13 +64,10 @@ public:
                 long style = wxCHOICEDLG_STYLE,
                 const wxPoint& pos = wxDefaultPosition);
 
-    void SetSelection(int sel) ;
+    void SetSelection(int sel);
     int GetSelection() const { return m_selection; }
     wxString GetStringSelection() const { return m_stringSelection; }
 
-    // get client data associated with selection
-    void *GetClientData() const { return m_clientData; }
-
     // obsolete function (NB: no need to make it return wxChar, it's untyped)
     char *GetSelectionClientData() const { return (char *)m_clientData; }
 
index 8b7e5bc941732278d004b67756d4ca1004ad2b24..560eee9c2b3044d37450a334e53fb09cb9ae1628 100644 (file)
@@ -233,8 +233,6 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
                                    const wxPoint& WXUNUSED(pos) )
 {
     m_selection = 0;
-    m_clientData = NULL;
-    m_stringSelection = wxT("");
 
     m_dialogStyle = style;
 
@@ -290,7 +288,8 @@ void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event))
 {
     m_selection = m_listbox->GetSelection();
     m_stringSelection = m_listbox->GetStringSelection();
-    m_clientData = m_listbox->GetClientData(m_selection);
+    if ( m_listbox->HasClientUntypedData() )
+        SetClientData(m_listbox->GetClientData(m_selection));
 
     EndModal(wxID_OK);
 }
@@ -299,7 +298,8 @@ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event))
 {
     m_selection = m_listbox->GetSelection();
     m_stringSelection = m_listbox->GetStringSelection();
-    m_clientData = m_listbox->GetClientData(m_selection);
+    if ( m_listbox->HasClientUntypedData() )
+        SetClientData(m_listbox->GetClientData(m_selection));
 
     EndModal(wxID_OK);
 }
index ae049dada82b7515e71eb127d0c798a9d635275c..9027f25b83ee71094c42c7385986079fc93841df 100644 (file)
@@ -310,8 +310,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
     gtk_widget_show( GTK_WIDGET(m_list) );
 
     wxSize newSize = size;
-    if (newSize.x == -1) newSize.x = 100;
-    if (newSize.y == -1) newSize.y = 110;
+    if (newSize.x == -1)
+        newSize.x = 100;
+    if (newSize.y == -1)
+        newSize.y = 110;
     SetSize( newSize.x, newSize.y );
 
     if ( style & wxLB_SORT )
@@ -319,6 +321,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
         // this will change DoAppend() behaviour
         m_strings = new wxSortedArrayString;
     }
+    else
+    {
+        m_strings = (wxSortedArrayString *)NULL;
+    }
 
     for (int i = 0; i < n; i++)
     {
index ae049dada82b7515e71eb127d0c798a9d635275c..9027f25b83ee71094c42c7385986079fc93841df 100644 (file)
@@ -310,8 +310,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
     gtk_widget_show( GTK_WIDGET(m_list) );
 
     wxSize newSize = size;
-    if (newSize.x == -1) newSize.x = 100;
-    if (newSize.y == -1) newSize.y = 110;
+    if (newSize.x == -1)
+        newSize.x = 100;
+    if (newSize.y == -1)
+        newSize.y = 110;
     SetSize( newSize.x, newSize.y );
 
     if ( style & wxLB_SORT )
@@ -319,6 +321,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
         // this will change DoAppend() behaviour
         m_strings = new wxSortedArrayString;
     }
+    else
+    {
+        m_strings = (wxSortedArrayString *)NULL;
+    }
 
     for (int i = 0; i < n; i++)
     {