]> git.saurik.com Git - wxWidgets.git/commitdiff
Created the model in wxDataViewListCtrl::Create().
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 27 Jul 2010 21:45:37 +0000 (21:45 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 27 Jul 2010 21:45:37 +0000 (21:45 +0000)
It was totally unexpected that construction through the ctor behaved
differently from Create(). Also, the behavior now actually matches
documentation.

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

src/common/datavcmn.cpp

index f7e5749ed1f4313973749465e45a4aced1163969..b63171d1182946fe16e9b626e23364073ce76add 100644 (file)
@@ -1600,10 +1600,6 @@ wxDataViewListCtrl::wxDataViewListCtrl( wxWindow *parent, wxWindowID id,
            const wxValidator& validator )
 {
     Create( parent, id, pos, size, style, validator );
-
-    wxDataViewListStore *store = new wxDataViewListStore;
-    AssociateModel( store );
-    store->DecRef();
 }
 
 wxDataViewListCtrl::~wxDataViewListCtrl()
@@ -1615,7 +1611,14 @@ bool wxDataViewListCtrl::Create( wxWindow *parent, wxWindowID id,
            const wxPoint& pos, const wxSize& size, long style,
            const wxValidator& validator )
 {
-    return wxDataViewCtrl::Create( parent, id, pos, size, style, validator );
+    if ( !wxDataViewCtrl::Create( parent, id, pos, size, style, validator ) )
+        return false;
+
+    wxDataViewListStore *store = new wxDataViewListStore;
+    AssociateModel( store );
+    store->DecRef();
+
+    return true;
 }
 
 bool wxDataViewListCtrl::AppendColumn( wxDataViewColumn *column, const wxString &varianttype )