Sign up

Pages: 1 2

gtkd 3.7.0 and tilix

I'm trying to run Tilix with GtkD 3.7.0 and am getting a segfault as soon as I call the run method for GTK Application. GDB shows the back trace below. I'm not sure if it's a GtkD problem or something I'm doing on my end since I do have some funky things here and there, but the back trace is pretty minimal of tilix artifacts.

I had look at line 159 in ObjectG, it is the opCast template declaration but unfortunately the back trace doesn't show what line in particular in causing the issue.

Any suggestions?

Thread 1 "tilix" received signal SIGSEGV, Segmentation fault.
0x00007ffff7508cc6 in invariant._d_invariant(Object) () from /usr/lib/libphobos2.so.0.76
(gdb) bte
Undefined command: "bte".  Try "help".
(gdb) bt
#0  0x00007ffff7508cc6 in invariant._d_invariant(Object) () at /usr/lib/libphobos2.so.0.76
#1  0x0000555555f9315a in gobject.ObjectG.ObjectG.opCast!(void*).opCast() (this=0x7ffff7eb6d40) at ../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d:159
#2  0x0000555555f91016 in gobject.ObjectG.ObjectG.toggleNotify(gobject.ObjectG.ObjectG, gobject.c.types.GObject*, int) (obj=0x7ffff7eb6d40, object=0x5555569eb040, isLastRef=1)
    at ../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d:129
#3  0x00007ffff25b1332 in g_value_unset () at /usr/lib/libgobject-2.0.so.0
#4  0x00007ffff25ad6cd in g_signal_emit_valist () at /usr/lib/libgobject-2.0.so.0
#5  0x00007ffff25ae920 in g_signal_emit () at /usr/lib/libgobject-2.0.so.0
#6  0x00007ffff28877ff in  () at /usr/lib/libgio-2.0.so.0
#7  0x00007ffff28881a1 in  () at /usr/lib/libgio-2.0.so.0
#8  0x00007ffff281613a in g_application_run () at /usr/lib/libgio-2.0.so.0
#9  0x0000555555f27ee4 in gio.Application.Application.run(immutable(char)[][]) (this=0x7ffff7edd800, argv=...)
    at ../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gio/Application.d:925
#10 0x0000555555dd32fd in D main (args=...) at source/app.d:146

Re: gtkd 3.7.0 and tilix

This is for DMD64 D Compiler v2.076.1

Also, I tried compiling with ldc2 version 1.2.0 (based on dmd 2.072.2) and get the following errors:

Performing "debug" build using ldc2 for x86_64.
gtk-d:gtkd 3.7.0: building configuration "library"...
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(231,43): Error: template instance hasStaticMember!(RT, "getType") template 'hasStaticMember' is not defined
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(242,11): Error: cannot create instance of interface IconIF
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gio/IconT.d(99,37): Error: template instance gobject.ObjectG.ObjectG.getDObject!(IconIF, IconIF, GIcon*) error instantiating
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(231,43): Error: template instance hasStaticMember!(RT, "getType") template 'hasStaticMember' is not defined
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(242,11): Error: cannot create instance of interface AppInfoIF
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gio/AppLaunchContext.d(315,45): Error: template instance gobject.ObjectG.ObjectG.getDObject!(AppInfoIF, AppInfoIF, GAppInfo*) error instantiating
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(231,43): Error: template instance hasStaticMember!(RT, "getType") template 'hasStaticMember' is not defined
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(242,11): Error: cannot create instance of interface ActionIF
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gio/ActionMapT.d(147,39): Error: template instance gobject.ObjectG.ObjectG.getDObject!(ActionIF, ActionIF, GAction*) error instantiating
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(231,43): Error: template instance hasStaticMember!(RT, "getType") template 'hasStaticMember' is not defined
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(242,11): Error: cannot create instance of interface FileIF
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gio/ApplicationCommandLine.d(253,37): Error: template instance gobject.ObjectG.ObjectG.getDObject!(FileIF, FileIF, GFile*) error instantiating
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(231,43): Error: template instance hasStaticMember!(RT, "getType") template 'hasStaticMember' is not defined
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(242,11): Error: cannot create instance of interface ConverterIF
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gio/ConverterInputStream.d(123,42): Error: template instance gobject.ObjectG.ObjectG.getDObject!(ConverterIF, ConverterIF, GConverter*) error instantiating
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(231,43): Error: template instance hasStaticMember!(RT, "getType") template 'hasStaticMember' is not defined
ldc2 failed with exit code 1.

Re: gtkd 3.7.0 and tilix

On 27-10-17 21:14, Gerald Nunn wrote:

I'm trying to run Tilix with GtkD 3.7.0 and am getting a segfault as soon as I call the run method for GTK Application. GDB shows the back trace below. I'm not sure if it's a GtkD problem or something I'm doing on my end since I do have some funky things here and there, but the back trace is pretty minimal of tilix artifacts.

I had look at line 159 in ObjectG, it is the opCast template declaration but unfortunately the back trace doesn't show what line in particular in causing the issue.

Any suggestions?

Thread 1 "tilix" received signal SIGSEGV, Segmentation fault.
0x00007ffff7508cc6 in invariant._d_invariant(Object) () from /usr/lib/libphobos2.so.0.76
(gdb) bte
Undefined command: "bte".  Try "help".
(gdb) bt
#0  0x00007ffff7508cc6 in invariant._d_invariant(Object) () at /usr/lib/libphobos2.so.0.76
#1  0x0000555555f9315a in gobject.ObjectG.ObjectG.opCast!(void*).opCast() (this=0x7ffff7eb6d40) at ../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d:159
#2  0x0000555555f91016 in gobject.ObjectG.ObjectG.toggleNotify(gobject.ObjectG.ObjectG, gobject.c.types.GObject*, int) (obj=0x7ffff7eb6d40, object=0x5555569eb040, isLastRef=1)
     at ../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d:129
#3  0x00007ffff25b1332 in g_value_unset () at /usr/lib/libgobject-2.0.so.0
#4  0x00007ffff25ad6cd in g_signal_emit_valist () at /usr/lib/libgobject-2.0.so.0
#5  0x00007ffff25ae920 in g_signal_emit () at /usr/lib/libgobject-2.0.so.0
#6  0x00007ffff28877ff in  () at /usr/lib/libgio-2.0.so.0
#7  0x00007ffff28881a1 in  () at /usr/lib/libgio-2.0.so.0
#8  0x00007ffff281613a in g_application_run () at /usr/lib/libgio-2.0.so.0
#9  0x0000555555f27ee4 in gio.Application.Application.run(immutable(char)[][]) (this=0x7ffff7edd800, argv=...)
     at ../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gio/Application.d:925
#10 0x0000555555dd32fd in D main (args=...) at source/app.d:146

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.

Re: gtkd 3.7.0 and tilix

On 27-10-17 21:19, Gerald Nunn wrote:

This is for DMD64 D Compiler v2.076.1

Also, I tried compiling with ldc2 version 1.2.0 (based on dmd 2.072.2) and get the following errors:

Performing "debug" build using ldc2 for x86_64.
gtk-d:gtkd 3.7.0: building configuration "library"...
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(231,43): Error: template instance hasStaticMember!(RT, "getType") template 'hasStaticMember' is not defined

hasStaticMember was added in 2.074, i will probably switch to hasMember.

Re: gtkd 3.7.0 and tilix

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

On 27-10-17 21:19, Gerald Nunn wrote:

This is for DMD64 D Compiler v2.076.1

Also, I tried compiling with ldc2 version 1.2.0 (based on dmd 2.072.2) and get the following errors:

Performing "debug" build using ldc2 for x86_64.
gtk-d:gtkd 3.7.0: building configuration "library"...
../../../.dub/packages/gtk-d-3.7.0/gtk-d/generated/gtkd/gobject/ObjectG.d(231,43): Error: template instance hasStaticMember!(RT, "getType") template 'hasStaticMember' is not defined

hasStaticMember was added in 2.074, i will probably switch to hasMember.

I should have realized that, I upgraded ldc2 and it compiles and runs fine now on ldc2.

Re: gtkd 3.7.0 and tilix

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.

Re: gtkd 3.7.0 and tilix

On Fri, 27 Oct 2017 22:06:12 GMT, 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.

One more data point, opening the preferences dialog when compiled with DMD crashes, on LDC it works fine.

Re: gtkd 3.7.0 and tilix

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.

Re: gtkd 3.7.0 and tilix

On 28-10-17 01:24, Gerald Nunn wrote:

On Fri, 27 Oct 2017 22:06:12 GMT, 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.

One more data point, opening the preferences dialog when compiled with DMD crashes, on LDC it works fine.

this line:

ProfilePreferenceRow row = 
cast(ProfilePreferenceRow)lbSide.getSelectedRow();

fails with dmd since getSelectedRow returns null and that then triggers
an assert when calling a member function.

With ldc it just calls the function while this == null and ends up
executing return cast(ProfilePreferenceRow)super, and returning null.

Since you can't define the opCast as a ufcs function and a static
doesn't have access to this the ldc behavior seens the desired behavior.

Re: gtkd 3.7.0 and tilix

On Sat, 28 Oct 2017 14:57:21 +0200, Mike Wey wrote:

this line:

ProfilePreferenceRow row = 
cast(ProfilePreferenceRow)lbSide.getSelectedRow();

fails with dmd since getSelectedRow returns null and that then triggers
an assert when calling a member function.

With ldc it just calls the function while this == null and ends up
executing return cast(ProfilePreferenceRow)super, and returning null.

Since you can't define the opCast as a ufcs function and a static
doesn't have access to this the ldc behavior seens the desired behavior.

Thanks as always Mike, I saw your thread on the dlang forum about this as well. Hopefully it can be resolved in some way that doesn't involve a new compiler version. :)

Pages: 1 2