Skip to content
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

TreeListCtrl.EditLabel() segfaults in Linux on pressing Escape #2629

Closed
suurjaak opened this issue Oct 23, 2024 · 3 comments
Closed

TreeListCtrl.EditLabel() segfaults in Linux on pressing Escape #2629

suurjaak opened this issue Oct 23, 2024 · 3 comments

Comments

@suurjaak
Copy link
Contributor

Operating system: Ubuntu Linux 20 & 22
wxPython version & source: 4.1.1 & 4.2.1 & 4.2.2, pypi
Python version & source: 3.8 & 3.10, distro

Description of the problem:

Starting to edit a wx.lib.gizmos.TreeListCtrl item label via EditLabel() and canceling edit with Escape crashes the program.

Steps to reproduce:

  • run sample program
  • double-click on a tree item label
  • press Escape in opened editbox

Expected behavior: editbox closes and tree item label remains unchanged.

Actual behavior: program crashes every time, with command-line printing:

GLib-GObject-WARNING **: 20:55:58.964: ../../../gobject/gsignal.c:2665:
 instance '0x646d59502be0' has no handler with id '110420807703312'
Segmentation fault (core dumped)

Does not crash with wxPython 4.0.7, btw. And in Windows, works fine with any version.

Code Example (click to expand)
import wx
import wx.lib.gizmos

class Window(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, parent=None)

        self.tree = wx.lib.gizmos.TreeListCtrl(self)
        self.tree.AddColumn("Column")
        root = self.tree.AddRoot("Root")
        for i in range(5):
            child = self.tree.AppendItem(root, "Item %s" % i)
        self.tree.Expand(root)
        self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate)
        self.Show()

    def OnActivate(self, event):
        self.tree.EditLabel(event.GetItem())

if __name__ == '__main__':
    app = wx.App()
    app.SetTopWindow(Window())
    app.MainLoop()
@reticulatus
Copy link
Contributor

I can reproduce this bug using wxPython 4.2.2 gtk3 (phoenix) wxWidgets 3.2.6 + Python 3.12.3 + Linux Mint 22.

TreeListCtrl is subclassed from HyperTreeList. When I run the HyperTreeList example in wxPython Demo and enable the TR_EDIT_LABELS option, then double-clicking on a label followed by pressing the Esc key crashes the demo application.

An issue for this bug was raised in 2021, see #1938

@suurjaak
Copy link
Contributor Author

I suppose this ticket can then be closed as duplicate; I did look for existing reports but did not think to search for "hypertreelist".

A pity that a fix has been available for over 2 years but still remains unmerged (#2088).

Thank you, @reticulatus, at least I can provide a workaround in my own code for now.

@suurjaak
Copy link
Contributor Author

Duplicate of #1938.

@suurjaak suurjaak closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants