gobject-introspection r204 - in trunk: . giscanner
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r204 - in trunk: . giscanner
- Date: Mon, 21 Apr 2008 22:01:50 +0100 (BST)
Author: johan
Date: Mon Apr 21 21:01:50 2008
New Revision: 204
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=204&view=rev
Log:
2008-04-21 Johan Dahlin <johan gnome org>
* giscanner/cgobject.py:
Add a workaround for a glib bug interface introspection bug
(object_interface_list_properties, object_class_list_properties):
Cast the return value to GParamSpec.
Modified:
trunk/ChangeLog
trunk/giscanner/cgobject.py
Modified: trunk/giscanner/cgobject.py
==============================================================================
--- trunk/giscanner/cgobject.py (original)
+++ trunk/giscanner/cgobject.py Mon Apr 21 21:01:50 2008
@@ -13,6 +13,7 @@
# Constants
+# FIXME: Are these stable?
TYPE_INVALID = 0
TYPE_INTERFACE = 8
TYPE_ENUM = 48
@@ -88,6 +89,12 @@
_gobj = ctypes.cdll.LoadLibrary('libgobject-2.0.so')
_gobj.g_type_init()
+# Workaround this error:
+# GLib-GObject-CRITICAL **: g_param_spec_pool_list:
+# assertion `pool != NULL' failed
+# which happens when trying to introspect an interface before instantiating
+# a GObject.
+_gobj.g_object_new(TYPE_OBJECT, None)
# Functions
@@ -126,7 +133,7 @@
n = ctypes.c_uint()
pspecs = _gobj.g_object_class_list_properties(klass, ctypes.byref(n))
for i in range(n.value):
- yield pspecs[i]
+ yield ctypes.cast(pspecs[i], ctypes.POINTER(GParamSpec)).contents
_gobj.g_object_interface_list_properties.restype = ctypes.POINTER(
ctypes.POINTER(GParamSpec))
@@ -135,7 +142,7 @@
n = ctypes.c_uint()
pspecs = _gobj.g_object_interface_list_properties(iface, ctypes.byref(n))
for i in range(n.value):
- yield pspecs[i]
+ yield ctypes.cast(pspecs[i], ctypes.POINTER(GParamSpec)).contents
_gobj.g_type_interfaces.restype = ctypes.POINTER(ctypes.c_int)
def type_interfaces(type_id):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]