On 28-10-17 00:06, Gerald Nunn wrote:

On Fri, 27 Oct 2017 23:21:23 +0200, Mike Wey wrote:

I've spend some time tracking this one down.

The second time gio.ApplicationCommandline is cast to void the invariant
of the class fails. This is related to the call to destroy in
source/gx/tilix/application.d line: 386. I still have to investigate why.

I can't reproduce the issue with ldc (1.4.0), only with dmd.

Thanks for the pointer, I changed that line to use the `Scoped!ApplicationCommandLine` version and now it works fine, I'm not sure what the issue with the destroy was either.

I also upgraded my ldc2 version as well, I should have realized that.

Fixed in:
https://github.com/gtkd-developers/GtkD/commit/a41f6318d64b845532246f5173f63213701682ad

destroy is an ufcs call to the destroy in druntime.
This invalidates the D object.
The D destructor doesn't remove the toggle reference.
When GTK unrefs the instance it triggers the toggle notify callback.
The callback receives the now invalid D object as its user data.
Casting this object to void now triggers the opCast which is a member
function.
When not build with --release the class invariant is run before and
after the opCast.
The invariant fails on the invalid D object.