Merge pull request #795 from RobinD42/fix-issue794

Fix possible ref-counting issues in DataViewCtrl
This commit is contained in:
Robin Dunn
2018-03-21 19:41:55 -07:00
committed by GitHub
2 changed files with 6 additions and 4 deletions

View File

@@ -245,11 +245,15 @@ class TestPanel(wx.Panel):
# Create an instance of our model...
if model is None:
self.model = MyTreeListModel(data, log)
newModel = True # it's a new instance so we need to decref it below
else:
self.model = model
newModel = False
# Tell the DVC to use the model
self.dvc.AssociateModel(self.model)
if newModel:
self.model.DecRef()
# Define the columns that we want in the view. Notice the
# parameter which tells the view which column in the data model to pull

View File

@@ -1,6 +1,4 @@
musicCtrl = wx.dataview.DataViewCtrl(self, wx.ID_ANY)
musicModel = MyMusicModel()
musicCtrl.AssociateModel(musicModel.get())
### wxPython does not provide wrappers for wxObjectDataPtr
# add columns now