I'm working on resolving some crash issues in Tilix (gnunn1/tilix#1192). Running tilix with GSLICE=debug_blocks shows a problem with the StyleContext.lookupColor method that returns an RGBA, attempt to release non-allocated block. The full stack trace is shown below.
Looking at the code for lookupColor, I can see that memory is being allocated for the RGBA so GtkD should own it, I'm not seeing why it has already been released? Note that most of the RGBA instances I am using are throwaway in the sense they can used in a method and go out of scope as soon as the method completes. The error occurs when the D GC is invoked.
If you want to reproduce it with tilix:
dub build --build=debug --config=trace
G_SLICE=debug-blocks gdb ./tilix
run
Once tilix is running, open the preference dialog and close it. If it doesn't happen, go into the hamburger menu and select GC to force a garbage collection cycle.
Here is the stack trace.
GSlice: MemChecker: attempt to release non-allocated block: 0x555557076510 size=32
Thread 1 "tilix" received signal SIGABRT, Aborted.
0x00007ffff64078a0 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff64078a0 in raise () at /usr/lib/libc.so.6
#1 0x00007ffff6408f09 in abort () at /usr/lib/libc.so.6
#2 0x00007ffff3cb0e09 in g_slice_free1 () at /usr/lib/libglib-2.0.so.0
#3 0x0000555555e49c8e in _D3gdk4RGBAQf6__dtorMFZv (this=0x7ffff7f390c0) at ../../../.dub/packages/gtk-d-3.7.2/gtk-d/generated/gtkd/gdk/RGBA.d:72
#4 0x00007ffff7510a87 in rt_finalize2 () at /usr/lib/libphobos2.so.0.77
#5 0x00007ffff7510b8a in rt_finalizeFromGC () at /usr/lib/libphobos2.so.0.77
#6 0x00007ffff75020c2 in _D2gc4impl12conservativeQw3Gcx5sweepMFNbZm () at /usr/lib/libphobos2.so.0.77
#7 0x00007ffff7502a11 in _D2gc4impl12conservativeQw3Gcx11fullcollectMFNbbZm () at /usr/lib/libphobos2.so.0.77
#8 0x00007ffff75007f2 in _D2gc4impl12conservativeQw3Gcx10smallAllocMFNbhKmkZPv () at /usr/lib/libphobos2.so.0.77
#9 0x00007ffff7504885 in _D2gc4impl12conservativeQw14ConservativeGC__T9runLockedS_DQCeQCeQCcQCnQBs12mallocNoSyncMFNbmkKmxC8TypeInfoZPvS_DQEgQEgQEeQEp10mallocTimelS_DQFiQFiQFgQFr10numMallocslTmTkTmTxQCzZQFcMFNbKmKkKmKxQDsZQDl () at /usr/lib/libphobos2.so.0.77
#10 0x00007ffff74fe36b in D2gc4impl12conservativeQw14ConservativeGC6qallocMFNbmkxC8TypeInfoZS4core6memory8BlkInfo () at /usr/lib/libphobos2.so.0.77
#11 0x00007ffff74fd59b in gc_qalloc () at /usr/lib/libphobos2.so.0.77
#12 0x00007ffff74f0470 in D4core6memory2GC6qallocFNaNbmkxC8TypeInfoZSQBqQBo8BlkInfo () at /usr/lib/libphobos2.so.0.77
#13 0x00007ffff739c5c4 in _D3std5array__T8AppenderTAyaZQo13ensureAddableMFNaNbNemZv () at /usr/lib/libphobos2.so.0.77
#14 0x0000555555cebaf7 in _D3std5array__T8AppenderTAyaZQo__T3putTQoZQiMFQvZ10bigDataFunMFNaNbNemZAa (this=0x7fffffffcc80, extra=4)
at /usr/include/dlang/dmd/std/array.d:3043
#15 0x0000555555ceba39 in _D3std5array__T8AppenderTAyaZQo__T3putTQoZQiMFNaNbNfQBbZv (this=..., items=...) at /usr/include/dlang/dmd/std/array.d:3046
#16 0x00007ffff744cffd in _D3std3xml__T6encodeTAyaZQmFNaNbNfQnZQq () at /usr/lib/libphobos2.so.0.77
#17 0x00007ffff7446b78 in _D3std3xml4Text6__ctorMFNaNfAyaZCQBfQBeQBd () at /usr/lib/libphobos2.so.0.77
#18 0x00007ffff7447951 in std.xml.ElementParser.parse() () at /usr/lib/libphobos2.so.0.77
#19 0x0000555555de38f9 in gx.tilix.prefeditor.prefdialog.ShortcutPreferences.loadLocalizedShortcutLabels() (this=0x7ffff7f44800)
at source/gx/tilix/prefeditor/prefdialog.d:926
#20 0x0000555555de415f in _D2gx5tilix10prefeditor10prefdialog19ShortcutPreferences13loadShortcutsMFC3gtk9TreeStoreQkZv (this=0x7ffff7f44800, ts=0x7ffff7f3e100)
at source/gx/tilix/prefeditor/prefdialog.d:958
#21 0x0000555555de233f in gx.tilix.prefeditor.prefdialog.ShortcutPreferences.createUI() (this=0x7ffff7f44800) at source/gx/tilix/prefeditor/prefdialog.d:734
#22 0x0000555555de46e9 in _D2gx5tilix10prefeditor10prefdialog19ShortcutPreferences6__ctorMFC3gio8SettingsQjZCQDdQDdQDaQCrQCi (this=0x7ffff7f44800, gsSettings=0x7ffff7efbf00) at source/gx/tilix/prefeditor/prefdialog.d:1002
#23 0x0000555555dded3c in gx.tilix.prefeditor.prefdialog.PreferenceDialog.createUI() (this=0x7ffff7f02000) at source/gx/tilix/prefeditor/prefdialog.d:153
#24 0x0000555555de096b in _D2gx5tilix10prefeditor10prefdialog16PreferenceDialog6__ctorMFC3gtk17ApplicationWindowQtZCQDkQDkQDhQCyQCp (this=0x7ffff7f02000, window=0x7fffe938d000) at source/gx/tilix/prefeditor/prefdialog.d:412
#25 0x0000555555d945ec in gx.tilix.application.Tilix.presentPreferences() (this=0x7ffff7edc800) at source/gx/tilix/application.d:760
#26 0x0000555555d9155a in gx.tilix.application.Tilix.onShowPreferences() (this=0x7ffff7edc800) at source/gx/tilix/application.d:274
#27 0x0000555555d91344 in _D2gx5tilix11application5Tilix14installAppMenuMFZ__T12__dgliteral5TC4glib7VariantQiTC3gio12SimpleActionQoZQCcMFQBsQBeZv (this=0x7ffff7eb4440, SimpleAction=0x7ffff7eb9200, GVariant=0x7ffff7efef20) at source/gx/tilix/application.d:210
#28 0x0000555555e73b4a in _D3gio12SimpleActionQo16callBackActivateUPSQBp1c5types13GSimpleActionPS4glibQBeQBf8GVariantCQDmQDlQDo25OnActivateDelegateWrapperZv (simpleactionStruct=0x5555566868a0, parameter=0x0, wrapper=0x7ffff7eb5d00) at ../../../.dub/packages/gtk-d-3.7.2/gtk-d/generated/gtkd/gio/SimpleAction.d:267
#29 0x00007ffff26516f5 in g_closure_invoke () at /usr/lib/libgobject-2.0.so.0
#30 0x00007ffff26650b0 in () at /usr/lib/libgobject-2.0.so.0
I'm working on resolving some crash issues in Tilix (gnunn1/tilix#1192). Running tilix with
GSLICE=debug_blocksshows a problem with the StyleContext.lookupColor method that returns an RGBA,attempt to release non-allocated block. The full stack trace is shown below.Looking at the code for lookupColor, I can see that memory is being allocated for the RGBA so GtkD should own it, I'm not seeing why it has already been released? Note that most of the RGBA instances I am using are throwaway in the sense they can used in a method and go out of scope as soon as the method completes. The error occurs when the D GC is invoked.
If you want to reproduce it with tilix:
Once tilix is running, open the preference dialog and close it. If it doesn't happen, go into the hamburger menu and select GC to force a garbage collection cycle.
Here is the stack trace.
GSlice: MemChecker: attempt to release non-allocated block: 0x555557076510 size=32
Thread 1 "tilix" received signal SIGABRT, Aborted.
0x00007ffff64078a0 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff64078a0 in raise () at /usr/lib/libc.so.6
#1 0x00007ffff6408f09 in abort () at /usr/lib/libc.so.6
#2 0x00007ffff3cb0e09 in g_slice_free1 () at /usr/lib/libglib-2.0.so.0
#3 0x0000555555e49c8e in _D3gdk4RGBAQf6__dtorMFZv (this=0x7ffff7f390c0) at ../../../.dub/packages/gtk-d-3.7.2/gtk-d/generated/gtkd/gdk/RGBA.d:72
#4 0x00007ffff7510a87 in rt_finalize2 () at /usr/lib/libphobos2.so.0.77
#5 0x00007ffff7510b8a in rt_finalizeFromGC () at /usr/lib/libphobos2.so.0.77
#6 0x00007ffff75020c2 in _D2gc4impl12conservativeQw3Gcx5sweepMFNbZm () at /usr/lib/libphobos2.so.0.77
#7 0x00007ffff7502a11 in _D2gc4impl12conservativeQw3Gcx11fullcollectMFNbbZm () at /usr/lib/libphobos2.so.0.77
#8 0x00007ffff75007f2 in _D2gc4impl12conservativeQw3Gcx10smallAllocMFNbhKmkZPv () at /usr/lib/libphobos2.so.0.77
#9 0x00007ffff7504885 in _D2gc4impl12conservativeQw14ConservativeGC__T9runLockedS_DQCeQCeQCcQCnQBs12mallocNoSyncMFNbmkKmxC8TypeInfoZPvS_DQEgQEgQEeQEp10mallocTimelS_DQFiQFiQFgQFr10numMallocslTmTkTmTxQCzZQFcMFNbKmKkKmKxQDsZQDl () at /usr/lib/libphobos2.so.0.77
#10 0x00007ffff74fe36b in D2gc4impl12conservativeQw14ConservativeGC6qallocMFNbmkxC8TypeInfoZS4core6memory8BlkInfo () at /usr/lib/libphobos2.so.0.77
#11 0x00007ffff74fd59b in gc_qalloc () at /usr/lib/libphobos2.so.0.77
#12 0x00007ffff74f0470 in D4core6memory2GC6qallocFNaNbmkxC8TypeInfoZSQBqQBo8BlkInfo () at /usr/lib/libphobos2.so.0.77
#13 0x00007ffff739c5c4 in _D3std5array__T8AppenderTAyaZQo13ensureAddableMFNaNbNemZv () at /usr/lib/libphobos2.so.0.77
#14 0x0000555555cebaf7 in _D3std5array__T8AppenderTAyaZQo__T3putTQoZQiMFQvZ10bigDataFunMFNaNbNemZAa (this=0x7fffffffcc80, extra=4)
at /usr/include/dlang/dmd/std/array.d:3043
#15 0x0000555555ceba39 in _D3std5array__T8AppenderTAyaZQo__T3putTQoZQiMFNaNbNfQBbZv (this=..., items=...) at /usr/include/dlang/dmd/std/array.d:3046
#16 0x00007ffff744cffd in _D3std3xml__T6encodeTAyaZQmFNaNbNfQnZQq () at /usr/lib/libphobos2.so.0.77
#17 0x00007ffff7446b78 in _D3std3xml4Text6__ctorMFNaNfAyaZCQBfQBeQBd () at /usr/lib/libphobos2.so.0.77
#18 0x00007ffff7447951 in std.xml.ElementParser.parse() () at /usr/lib/libphobos2.so.0.77
#19 0x0000555555de38f9 in gx.tilix.prefeditor.prefdialog.ShortcutPreferences.loadLocalizedShortcutLabels() (this=0x7ffff7f44800)
at source/gx/tilix/prefeditor/prefdialog.d:926
#20 0x0000555555de415f in _D2gx5tilix10prefeditor10prefdialog19ShortcutPreferences13loadShortcutsMFC3gtk9TreeStoreQkZv (this=0x7ffff7f44800, ts=0x7ffff7f3e100)
at source/gx/tilix/prefeditor/prefdialog.d:958
#21 0x0000555555de233f in gx.tilix.prefeditor.prefdialog.ShortcutPreferences.createUI() (this=0x7ffff7f44800) at source/gx/tilix/prefeditor/prefdialog.d:734
#22 0x0000555555de46e9 in _D2gx5tilix10prefeditor10prefdialog19ShortcutPreferences6__ctorMFC3gio8SettingsQjZCQDdQDdQDaQCrQCi (this=0x7ffff7f44800, gsSettings=0x7ffff7efbf00) at source/gx/tilix/prefeditor/prefdialog.d:1002
#23 0x0000555555dded3c in gx.tilix.prefeditor.prefdialog.PreferenceDialog.createUI() (this=0x7ffff7f02000) at source/gx/tilix/prefeditor/prefdialog.d:153
#24 0x0000555555de096b in _D2gx5tilix10prefeditor10prefdialog16PreferenceDialog6__ctorMFC3gtk17ApplicationWindowQtZCQDkQDkQDhQCyQCp (this=0x7ffff7f02000, window=0x7fffe938d000) at source/gx/tilix/prefeditor/prefdialog.d:412
#25 0x0000555555d945ec in gx.tilix.application.Tilix.presentPreferences() (this=0x7ffff7edc800) at source/gx/tilix/application.d:760
#26 0x0000555555d9155a in gx.tilix.application.Tilix.onShowPreferences() (this=0x7ffff7edc800) at source/gx/tilix/application.d:274
#27 0x0000555555d91344 in _D2gx5tilix11application5Tilix14installAppMenuMFZ__T12__dgliteral5TC4glib7VariantQiTC3gio12SimpleActionQoZQCcMFQBsQBeZv (this=0x7ffff7eb4440, SimpleAction=0x7ffff7eb9200, GVariant=0x7ffff7efef20) at source/gx/tilix/application.d:210
#28 0x0000555555e73b4a in _D3gio12SimpleActionQo16callBackActivateUPSQBp1c5types13GSimpleActionPS4glibQBeQBf8GVariantCQDmQDlQDo25OnActivateDelegateWrapperZv (simpleactionStruct=0x5555566868a0, parameter=0x0, wrapper=0x7ffff7eb5d00) at ../../../.dub/packages/gtk-d-3.7.2/gtk-d/generated/gtkd/gio/SimpleAction.d:267
#29 0x00007ffff26516f5 in g_closure_invoke () at /usr/lib/libgobject-2.0.so.0
#30 0x00007ffff26650b0 in () at /usr/lib/libgobject-2.0.so.0