Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gtk gtk
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,601
    • Issues 1,601
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 217
    • Merge requests 217
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • gtkgtk
  • Issues
  • #4019
Closed
Open
Issue created Jun 09, 2021 by Bilal Elmoussaoui@bilelmoussaouiDeveloper

Crash on ListBoxRow.get_index

We received an issue in the gtk4 rust bindings where get_index of Gtk.ListBoxRow causes a crash

Upstream issue: https://github.com/gtk-rs/gtk4-rs/issues/447

I managed to reproduce it with Python

from gi import require_version
require_version("Gtk", "4.0")
from gi.repository import Gtk

class App(Gtk.Application):
    def __init__(self):
        super().__init__()

    def do_activate(self):
        window = Gtk.ApplicationWindow.new(self)
        vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        self.listbox = Gtk.ListBox.new()
        self.listbox.append(Gtk.Label.new("Crash"))
        
        button = Gtk.Button.new_with_label("Click me")
        button.connect("clicked", self.on_clicked)
        
        vbox.append(self.listbox)
        vbox.append(button)
        window.set_child(vbox)
        window.show()

    def on_clicked(self, button):
        row = self.listbox.get_selected_row()
        self.listbox.remove(row)
        print(row.get_index())

def main():
    app = App()
    app.run()
main()

The crash only happens from time to time whenever you click on the button. Normally, if the row isn't part of the listbox anymore, it should return an index of -1 instead of crashing.

The backtrace doesn't contain anything useful other than the issue happening on glib side, at 0 0x00007fffe9fc9b28 in node_get_pos () at /lib64/libglib-2.0.so.0. I assume there's a missing g_return_if_fail that validates the GSequenceIter.

Assignee
Assign to
Time tracking