Types derived of G_TYPE_ENUM or G_TYPE_FLAGS not handled correctly in gom_cursor_get_column()
In my application I added a new property which is derived from an enum type (glib-mkenums
)
and installed it into my resource class. The migration worked just fine.
When fetching the contents of my table and constructing my GomResource
I'm running into a failed assertion.
Since the code already has a case for G_TYPE_ENUM
(and G_TYPE_FLAGS
) I added some debug printing to see what's going on:
g_print ("col %u, type %u, is enum? %u\n", column, G_VALUE_TYPE(value), G_TYPE_IS_ENUM(G_VALUE_TYPE(value)));
08:44:49.5171 CallsRecordStore[198392]: DEBUG: Successfully opened call record database `/home/fortysixandtwo/.local/share/calls/records.db'
08:44:49.5171 CallsRecordStore[198392]: DEBUG: Attempting migration of call record database `/home/fortysixandtwo/.local/share/calls/records.db'
08:44:49.5181 CallsRecordStore[198392]: DEBUG: Successfully migrated call record database `/home/fortysixandtwo/.local/share/calls/records.db'
08:44:49.5182 CallsRecordStore[198392]: DEBUG: Finding records in call record database `/home/fortysixandtwo/.local/share/calls/records.db'
08:44:49.5187 CallsRecordStore[198392]: DEBUG: Found 1136 call records in database `/home/fortysixandtwo/.local/share/calls/records.db', fetching
col 0, type 28, is enum? 0
col 0, type 28, is enum? 0
col 0, type 28, is enum? 0
col 1, type 64, is enum? 0
col 2, type 20, is enum? 0
col 3, type 1438270704, is enum? 0
col 4, type 1438270704, is enum? 0
col 5, type 1438270704, is enum? 0
col 6, type 64, is enum? 0
col 7, type 64, is enum? 0
col 8, type 64, is enum? 0
col 9, type 1438271360, is enum? 1
**
ERROR:../gom/gom-cursor.c:154:gom_cursor_get_column: code should not be reached
Bail out! ERROR:../gom/gom-cursor.c:154:gom_cursor_get_column: code should not be reached
Thread 7 "gnome-calls" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffe2a73640 (LWP 198402)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
49 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
#1 0x00007ffff6e96536 in __GI_abort () at abort.c:79
#2 0x00007ffff7e18dcc in g_assertion_message (domain=<optimized out>, file=<optimized out>, line=<optimized out>, func=<optimized out>, message=<optimized out>) at ../../../glib/gtestutils.c:3223
#3 0x00007ffff7e7805b in g_assertion_message_expr (domain=0x0, file=0x7ffff7203f0d "../gom/gom-cursor.c", line=154, func=0x7ffff7204050 <__func__.4> "gom_cursor_get_column", expr=<optimized out>) at ../../../glib/gtestutils.c:3249
#4 0x00007ffff71f3872 in gom_cursor_get_column (cursor=0x5555558d5d30 [GomCursor], column=9, value=0x7fffcc049420) at ../gom/gom-cursor.c:154
#5 0x00007ffff72002ba in set_props (resource_type=0x55555577de00 [CallsCallRecord/GomResource], cursor=0x5555558d5d30 [GomCursor]) at ../gom/gom-resource-group.c:639
#6 0x00007ffff7200c08 in gom_resource_group_fetch_cb (adapter=0x7fffdc005da0 [GomAdapter], user_data=0x555555bb4c40) at ../gom/gom-resource-group.c:733
#7 0x00007ffff71ed51e in gom_adapter_worker (data=0x55555577dfb0) at ../gom/gom-adapter.c:110
#8 0x00007ffff7e78efd in g_thread_proxy (data=0x5555558f5f00) at ../../../glib/gthread.c:827
#9 0x00007ffff7040d80 in start_thread (arg=0x7fffe2a73640) at pthread_create.c:481
#10 0x00007ffff6f6cbdf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
This is the schema of my database:
CREATE TABLE IF NOT EXISTS 'calls' ('id' INTEGER PRIMARY KEY AUTOINCREMENT,'target' TEXT,'inbound' INTEGER,'start' BLOB,'answered' BLOB,'end' BLOB, 'protocol' TEXT, 'origin-id' TEXT, 'origin-name' TEXT, 'call-type' INTEGER);
The 'call-type' is my newly added enum.