New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wx.dataview.DataViewTreeCtrl crash when using data association to elements #856

xader opened this Issue May 16, 2018 · 2 comments


2 participants

xader commented May 16, 2018

Operating system: Windows 10
wxPython version: 4.0.1
Stock or custom build: stock
Python version: 3.6.3
Stock or custom build: Stock

Description of the problem:
crash during exit or by explictly calling DeleteAllItems

import wx
import wx.dataview
if __name__ == '__main__':
    app = wx.App()
    frame = wx.Frame(None,-1)
    panel = wx.Panel(frame)
    sizer = wx.BoxSizer(wx.VERTICAL)
    treectrl = wx.dataview.DataViewTreeCtrl(panel)
    sizer.Add(treectrl, -1, wx.EXPAND)
    data =  wx.ClientDataContainer()
    data.SetClientData('test data')
    treectrl.AppendContainer(wx.dataview.NullDataViewItem,'test', data=data)

This comment has been minimized.


RobinD42 commented May 16, 2018

It looks there are some misunderstandings here.

  1. wx.ClientDataContainer is not meant to be used this way. It's used as the common base class for other classes that can have client data. IOW, it's a convenient way to add Get/SetClientData methods to a bunch of other classes. I think it's mostly used in classes in the wxGrid family.

  2. wx.dataview.DataViewTreeCtrl.AppendContainer does not mean "append an item with client data" it means "append an item that has (or contains) child items."

  3. wxPython has special support for the C++ wxClientData class which allows any Python object to be passed in and it will take care of things like the refcount and such. So you can use anything there, like data="test data" or data=["test", "data"] or data=someObject or whatever. However it is still crashing when data is assigned to an item, so I'll dig into that and get it fixed.


This comment has been minimized.


RobinD42 commented May 17, 2018

Fixed in #858

@RobinD42 RobinD42 closed this May 17, 2018

4.0.2 automation moved this from In progress to Done May 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment