[grilo] registry: fix SIGSEGV on unhandled GType



commit 1169e447417f8305e89ac1624c3ecedc6cd0ba5b
Author: Victor Toso <me victortoso com>
Date:   Tue Oct 2 11:33:36 2018 +0200

    registry: fix SIGSEGV on unhandled GType
    
    Found it while writing unit tests for it.
    
    Backtrace:
     | Thread 1 "media" received signal SIGSEGV, Segmentation fault.
     | grl_registry_register_metadata_key_for_type (registry=registry@entry=0x6180d0,
     | key_name=key_name@entry=0x615fdd "grl-key-double-set-that-does-not-exist",
     | type=type@entry=60) at ../src/grl-registry.c:643
    
     | 643           GRL_WARNING ("'%s' is being ignored as G_TYPE '%s' is not being handled",
    
     | (gdb) bt
     | #0  0x00007ffff7bbd260 in grl_registry_register_metadata_key_for_type
     |     (registry=registry@entry=0x6180d0, key_name=key_name@entry=0x615fdd
     |     "grl-key-double-set-that-does-not-exist", type=type@entry=60)
     |     at ../src/grl-registry.c:643
     | #1  0x00007ffff7bad1e9 in grl_data_set_for_id (data=0x642d60,
     |     key_name=0x615fdd "grl-key-double-set-that-does-not-exist",
     |     key_name@entry=0x60da10 "grl-key-double-set-that-does-not-exist",
     |     value=value@entry=0x7fffffffd2e0) at ../src/data/grl-data.c:685
     | #2  0x00000000004016b9 in test_set_for_id_new_key (fixture=0x613bf0,
     |     data=0x1) at ../tests/media.c:103
    
    Signed-off-by: Victor Toso <victortoso gnome org>

 src/grl-registry.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/grl-registry.c b/src/grl-registry.c
index 43a3a3f..4124ddd 100644
--- a/src/grl-registry.c
+++ b/src/grl-registry.c
@@ -641,7 +641,7 @@ grl_registry_register_metadata_key_for_type (GrlRegistry *registry,
                                    G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
     } else {
       GRL_WARNING ("'%s' is being ignored as G_TYPE '%s' is not being handled",
-                   key_name, G_VALUE_TYPE_NAME (type));
+                   key_name, g_type_name (type));
       return GRL_METADATA_KEY_INVALID;
     }
   }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]