Skip to content

ListBoxItem toggle_refs_notify: assertion failed #343

@MitchellLarson

Description

@MitchellLarson

I've found a rather odd assertion failure in toggle_refs_notify. I know most of the time, this is caused by a threading issue (and that's what I thought it was at first) but I've made a minimal program without threading to replicate.

import core.memory;
import core.thread;
import gtk.Label;
import gtk.ListBox;
import gtk.ListBoxRow;
import gtk.Main;
import gtk.Widget;
import std.stdio;

void main(string[] args)
{
  Main.init(args);

  breakThings();

  writefln("Fail now!");
  GC.collect();
}

void breakThings()
{
  ListBox listBox = new ListBox();
  listBox.add(new Label("My Label"));

  ListBoxRow listBoxRow = cast(ListBoxRow) listBox.getChildren.toArray!Widget[0];
}

This program produces the following output when compiled and run with dub:

Performing "debug" build using /usr/local/bin/ldc2 for x86_64.
gtk-d:gtkd 3.9.0: target for configuration "library" is up to date.
gtk-d:gstreamer 3.9.0: target for configuration "library" is up to date.
gtk-d:peas 3.9.0: target for configuration "library" is up to date.
gtk-d:sv 3.9.0: target for configuration "library" is up to date.
gtk-d:vte 3.9.0: target for configuration "library" is up to date.
test ~master: target for configuration "application" is up to date.
To force a rebuild of up-to-date targets, run again with --force.
Running ./test 
Fail now!
**
GLib-GObject:ERROR:../../../gobject/gobject.c:3055:toggle_refs_notify: assertion failed: (tstack.n_toggle_refs == 1)

I don't have a super detailed understanding of GtkD, so if I'm just being stupid and mis-using something please tell me. Otherwise, is this some kind of bug? I was not able to replicate this bug with a simple box; It seems that ListBox is important. I know that ListBox creates an automatic ListBoxRow, so perhaps that's related?

This is all compiled using LDC2. Below is the output of ldc2 --version in case it matters:

LDC - the LLVM D compiler (1.27.1-git-faea8aa):
  based on DMD v2.097.2 and LLVM 12.0.1
  built with LDC - the LLVM D compiler (1.27.1-git-faea8aa)
  Default target: x86_64-unknown-linux-gnu
  Host CPU: ivybridge
  http://dlang.org - http://wiki.dlang.org/LDC

  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_32 - AArch64 (little endian ILP32)
    aarch64_be - AArch64 (big endian)
    amdgcn     - AMD GCN GPUs
    arm        - ARM
    arm64      - ARM64 (little endian)
    arm64_32   - ARM64 (little endian ILP32)
    armeb      - ARM (big endian)
    avr        - Atmel AVR Microcontroller
    mips       - MIPS (32-bit big endian)
    mips64     - MIPS (64-bit big endian)
    mips64el   - MIPS (64-bit little endian)
    mipsel     - MIPS (32-bit little endian)
    msp430     - MSP430 [experimental]
    nvptx      - NVIDIA PTX 32-bit
    nvptx64    - NVIDIA PTX 64-bit
    ppc32      - PowerPC 32
    ppc32le    - PowerPC 32 LE
    ppc64      - PowerPC 64
    ppc64le    - PowerPC 64 LE
    r600       - AMD GPUs HD2XXX-HD6XXX
    riscv32    - 32-bit RISC-V
    riscv64    - 64-bit RISC-V
    thumb      - Thumb
    thumbeb    - Thumb (big endian)
    wasm32     - WebAssembly 32-bit
    wasm64     - WebAssembly 64-bit
    x86        - 32-bit X86: Pentium-Pro and above
    x86-64     - 64-bit X86: EM64T and AMD64

Thank you for any and all assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions