mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 04:20:07 +01:00
Merge pull request #795 from RobinD42/fix-issue794
Fix possible ref-counting issues in DataViewCtrl
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user