Last active
June 19, 2017 12:43
-
-
Save felipeborges/2f744a81a4436cd2447e7049aeb70d2f to your computer and use it in GitHub Desktop.
This patch should be enough to make it work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 710b85a3ebabc98127c4d7ce7345caec05e26e20 Mon Sep 17 00:00:00 2001 | |
From: Felipe Borges <[email protected]> | |
Date: Mon, 19 Jun 2017 14:42:42 +0200 | |
Subject: [PATCH] Correct the usage of the GObject boilerplate macros | |
--- | |
backend/gcp.h | 5 ++--- | |
1 file changed, 2 insertions(+), 3 deletions(-) | |
diff --git a/backend/gcp.h b/backend/gcp.h | |
index 7c00b76..ef903ca 100644 | |
--- a/backend/gcp.h | |
+++ b/backend/gcp.h | |
@@ -6,14 +6,13 @@ | |
G_BEGIN_DECLS | |
-typedef struct _GCPObject GCPObject; | |
-typedef struct _GCPObjectClass GCPObjectClass; | |
- | |
#define GCP_TYPE_OBJECT gcp_object_get_type() | |
G_DECLARE_DERIVABLE_TYPE (GCPObject, gcp_object, GCP, OBJECT, GObject) | |
struct _GCPObjectClass | |
{ | |
+ GObjectClass parent; | |
+ | |
gchar * (*get_printers) (GCPObject *, const gchar *); | |
gchar * (*get_printer_options) (GCPObject *, | |
-- | |
2.13.0 |
so if I keep it as it is... then after running main it is calling gcp_object_new... after that it is calling gcp_object_get_printers()... here it is getting stuck in second line when it calls g_return_val_if_fail ()
the output in my terminal is
./main
inside main()
calling gcp_object_new()
inside gcp_object_new()
(process:3290): GLib-GObject-WARNING **: specified class size for type 'GCPObject' is smaller than the parent type's 'GObject' class size
(process:3290): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(process:3290): GLib-GObject-CRITICAL **: g_object_new: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
outside gcp_object_new()
calling gcp_object_get_printers()
inside gcp_object_get_printers()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
shouldn't it be
G_DEFINE_TYPE (GCPObject, gcp_object, G_TYPE_OBJECT)
instead of
G_DEFINE_TYPE (GCPObject, gcp_object, GCP_TYPE_OBJECT)
as the third param is supposed to be the GType of the parent type
reference : https://developer.gnome.org/gobject/stable/gobject-Type-Information.html#G-DEFINE-TYPE:CAPS