CSS child / sibling assertion error on keyboard input

I get this ominous - but strangely non-blocking - error in the console, and only after keyboard input (any input, like Alt-tab to switch windows)

Gtk-CRITICAL **: 21:17:36.536: gtk_css_node_insert_after: assertion 'previous_sibling == NULL || previous_sibling->parent == parent' failed

I managed to trace it (no line # or context, that’s harsh) back to the building of a - prototype - Gtk.TreeView:

        self.button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.prev_button = Gtk.Button(label="Prev")
        self.pause_button = Gtk.Button(label="Pause")
        self.next_button = Gtk.Button(label="Next")
        self.main_paned = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL)
        self.playlist = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.main_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.video = Gtk.Video()
        self.list_store = Gtk.ListStore(int, str)
        self.playlist_tree_view = Gtk.TreeView(model=self.list_store)
        self.playlist_sw = Gtk.ScrolledWindow()

        #Playlist logic
        
        def convert(list):
            return tuple(list)

        self.playList = []

        if os.path.exists("playlist.txt"):
            with open("playlist.txt") as f:
                lines = [line.rstrip() for line in f]
                
        for i in range(len(lines)):
            self.playList.append(convert([i, lines[i]]))

        for video in self.playList:
            self.list_store.append(list(video))

        for i, col_title in enumerate(["Num", "Uri"]):
            renderer = Gtk.CellRendererText()
            column = Gtk.TreeViewColumn(col_title, renderer, text=i)
            self.playlist_tree_view.append_column(column)

        # /Playlist

    self.button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
    self.prev_button = Gtk.Button(label="Prev")
    self.pause_button = Gtk.Button(label="Pause")
    self.next_button = Gtk.Button(label="Next")
    self.main_paned = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL)
    self.playlist = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
    self.main_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
    self.video = Gtk.Video()
    self.list_store = Gtk.ListStore(int, str)
    self.playlist_tree_view = Gtk.TreeView(model=self.list_store)
    self.playlist_sw = Gtk.ScrolledWindow()
    
    #Playlist logic
    
    def convert(list):
        return tuple(list)
    
    self.playList = []
    
    if os.path.exists("playlist.txt"):
        with open("playlist.txt") as f:
            lines = [line.rstrip() for line in f]
            
    for i in range(len(lines)):
        self.playList.append(convert([i, lines[i]]))
    
    for video in self.playList:
        self.list_store.append(list(video))
    
    for i, col_title in enumerate(["Num", "Uri"]):
        renderer = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn(col_title, renderer, text=i)
        self.playlist_tree_view.append_column(column)
    
    # /Playlist

    self.playlist_sw.set_child(self.playlist_tree_view)
    
    self.button_box.append(self.prev_button)
    self.button_box.append(self.pause_button)
    self.button_box.append(self.next_button)
    
    self.main_paned.set_start_child(self.video)
    self.main_paned.set_end_child(self.playlist_sw)
    
    self.main_box.append(self.main_paned)
    self.main_box.append(self.button_box)
    
    self.set_child(self.main_box)

If I remove the self.playlist_tree_view.append_column(column) the error doesn’t occur, so I must be doing something wrong in the building of my TreeView…? I noticed a “search” widget that pops up when I type over the view, could this be causing this error? Note that the App behaves exactly like it should, but I need to understand what is going on here. I tried various container strategies, but it always comes down to this append_column.

NB I’m still stuck on a small ARM machine, where I can’t install (and boy did I try) Builder / Workbench which hopefully has introspection capabilities that could help me visualize the, hum, DOM? But in the meantime it’s really shots in the dark.

EDIT: So yes, apparently the problem is the small bubble that pops up when you enter text (which is very handly, and it works BTW, it does fuzzy-search the listview, very handy & powerful) but I must be doing something wrong container-wise, does this error on “popups” ring a bell to anyone?

I have seen that message, but in a different context: a GtkNotebook inside a GtkPaned, being realized. I couldn’t make a simple reproducer.

As I recall, previous_sibling was not NULL, but previous_sibling->parent was not the same as parent, so the assertion failed. But previous_sibling->parent->parent was the same as parent. Apparently another GtkCssNode had been inserted into the tree, but the guard doesn’t like it.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.