[no subject]



To reproduce the error, I compile my modified cheese.c with:

gcc -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -g -Wall -c -o cheese.o
cheese.c
gcc -g -O2 -Wall -o cheese cheese.o -pthread -ldbus-glib-1
-lgstinterfaces-0.10

And this is my current cheese.c:

---------- cheese.c ----------
#include <dbus/dbus-glib-bindings.h>
#include <stdio.h>
#include <glib/gi18n.h>

G_BEGIN_DECLS

typedef struct {
  GObjectClass parent_class;
  DBusGConnection *connection;
} CheeseDbusClass;

typedef struct _CheeseDbus {
  GObject parent;
} CheeseDbus;

#define CHEESE_TYPE_DBUS (cheese_dbus_get_type ())
#define CHEESE_DBUS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),
CHEESE_TYPE_DBUS, CheeseDbusClass))

GType       cheese_dbus_get_type (void);
CheeseDbus *cheese_dbus_new (void);

void     cheese_dbus_set_window (gpointer);
gboolean cheese_dbus_notify (void);

G_END_DECLS

G_BEGIN_DECLS

#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer

extern void dbus_glib_marshal_cheese_dbus_BOOLEAN__POINTER (GClosure
*closure,
                                                            GValue
*return_value,
                                                            guint
n_param_values,
                                                            const GValue
*param_values,
                                                            gpointer
invocation_hint,
                                                            gpointer
marshal_data);
void
dbus_glib_marshal_cheese_dbus_BOOLEAN__POINTER (GClosure     *closure,
                                                GValue       *return_value
G_GNUC_UNUSED,
                                                guint
n_param_values,
                                                const GValue *param_values,
                                                gpointer
invocation_hint G_GNUC_UNUSED,
                                                gpointer      marshal_data)
{
  typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER) (gpointer     data1,
                                                     gpointer     arg_1,
                                                     gpointer     data2);
  register GMarshalFunc_BOOLEAN__POINTER callback;
  register GCClosure *cc = (GCClosure*) closure;
  register gpointer data1, data2;
  gboolean v_return;

  g_return_if_fail (return_value != NULL);
  g_return_if_fail (n_param_values == 2);

  if (G_CCLOSURE_SWAP_DATA (closure))
    {
      data1 = closure->data;
      data2 = g_value_peek_pointer (param_values + 0);
    }
  else
    {
      data1 = g_value_peek_pointer (param_values + 0);
      data2 = closure->data;
    }
  callback = (GMarshalFunc_BOOLEAN__POINTER) (marshal_data ? marshal_data :
cc->callback);

  v_return = callback (data1,
                       g_marshal_value_peek_pointer (param_values + 1),
                       data2);

  g_value_set_boolean (return_value, v_return);
}

G_END_DECLS

static const DBusGMethodInfo dbus_glib_cheese_dbus_methods[] = {
  { (GCallback) cheese_dbus_notify,
dbus_glib_marshal_cheese_dbus_BOOLEAN__POINTER, 0 },
};

const DBusGObjectInfo dbus_glib_cheese_dbus_object_info = {
  0,
  dbus_glib_cheese_dbus_methods,
  1,
"org.gnome.Cheese\0notify\0S\0\0\0",
"\0",
"\0"
};

gpointer window_pointer;

G_DEFINE_TYPE (CheeseDbus, cheese_dbus, G_TYPE_OBJECT);

void cheese_dbus_set_window (gpointer data) {
  if (data != NULL)
    window_pointer = data;
}

gboolean cheese_dbus_notify () {
  return TRUE;
}

void cheese_dbus_class_init (CheeseDbusClass *klass) {
  GError *error = NULL;

  /* Init the DBus connection, per-klass */
  klass->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
  if (klass->connection == NULL) {
    g_warning ("Unable to connect to dbus: %s", error->message);
    g_error_free (error);
    return;
  }

  dbus_g_object_type_install_info (CHEESE_TYPE_DBUS,
&dbus_glib_cheese_dbus_object_info);
}

void cheese_dbus_init (CheeseDbus *server) {
  CheeseDbusClass *klass = CHEESE_DBUS_GET_CLASS (server);

  /* Register DBUS path */
  dbus_g_connection_register_g_object (klass->connection,
"/org/gnome/cheese", G_OBJECT (server));
}

CheeseDbus* cheese_dbus_new () {
  CheeseDbus      *server;
  GError          *error = NULL;
  DBusGProxy      *proxy;
  guint            request_ret;
  CheeseDbusClass *klass;

  server = g_object_new (CHEESE_TYPE_DBUS, NULL);

  klass = CHEESE_DBUS_GET_CLASS (server);

  /* Register the service name, the constant here are defined in
dbus-glib-bindings.h */
  proxy = dbus_g_proxy_new_for_name (klass->connection, DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);

  if (!org_freedesktop_DBus_request_name (proxy, "org.gnome.Cheese", 0,
&request_ret, &error)) {
    g_warning ("Unable to register service: %s", error->message);
    g_error_free (error);
  }

  /* check if there is already a instance running -> exit*/
  if (request_ret == DBUS_REQUEST_NAME_REPLY_EXISTS || request_ret ==
DBUS_REQUEST_NAME_REPLY_IN_QUEUE) {
    g_warning ("Another instance of cheese is already running!");

    /* notify the other instance of cheese*/
    proxy = dbus_g_proxy_new_for_name (klass->connection,
"org.gnome.Cheese", "/org/gnome/cheese", "org.gnome.Cheese");

    if (!dbus_g_proxy_call (proxy, "notify", &error, G_TYPE_INVALID,
G_TYPE_INVALID)) {
      /* Method failed, the GError is set, let's warn everyone */
      g_warning ("Notifying the other cheese instance failed: %s",
error->message);
      g_error_free (error);
    }

    g_object_unref (server);
    server = NULL;
  }

  g_object_unref (proxy);

  return server;
}

int main (int argc, char **argv) {
  CheeseDbus *dbus_server;

  g_thread_init (NULL);

  dbus_server = cheese_dbus_new ();
  if (dbus_server == NULL) {
    printf("failed\n");
    return -1;
  }

  printf("success\n");
  return 0;
}
--------------------


The output I get is this:

$ ./cheese

(process:22856): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.18.2/gobject/gtype.c:2458: initialization assertion
failed, use IA__g_type_init() prior to this function

(process:22856): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed

(process:22856): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OBJECT (object_type)' failed



Using gdb, I find that the error lies on line 131 (originally on line 94 in
cheese-dbus.c) which is the one that says "server = g_object_new
(CHEESE_TYPE_DBUS, NULL);"


Any idea what the problem is?

Regards
Jostein A. Jacobsen

--0016e6de0033b47cf904650441e8
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi<br><br>I&#39;m trying to modify Cheese for a webcam capture application =
of my own. I simply need to fetch images from a webcam at the highest possi=
ble rate for further processing in my own program (embedded, no GUI), and C=
heese seems compatible with a wide range of cameras and has well-written co=
de.<br>

<br>From how I understand the code, I will want to connect to the GstElemen=
t webcam_source_bin and write my own GStreamer sink if I want access to the=
 webcam... Unfortunately I&#39;m new to GLib, GObjects and GStreamer, but I=
&#39;ve been reading up on it for a couple of days now and have successfull=
y modified and compiled Cheese (If it still can be called that) without war=
nings, errors or any GUI dependencies (GTK, GDK, etc.). However, it won&#39=
;t execute as I had hoped. I have further removed as much as possible of th=
e code, includes and linked libraries to narrow down the possible sources o=
f error without changing the error I get. Compiling and running Cheese with=
out modification works flawlessly.<br>

<br>To reproduce the error, I compile my modified cheese.c with:<br><br><sp=
an style=3D"font-family: courier new,monospace;">gcc -pthread -I/usr/includ=
e/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib/d=
bus-1.0/include -g -Wall -c -o cheese.o cheese.c</span><br style=3D"font-fa=
mily: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">gcc -g -O2 -Wall -o che=
ese cheese.o -pthread -ldbus-glib-1 -lgstinterfaces-0.10</span><br> <br>And=
 this is my current cheese.c:<br><br>---------- cheese.c ----------<br><spa=
n style=3D"font-family: courier new,monospace;">#include &lt;dbus/dbus-glib=
-bindings.h&gt;</span><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">#include &lt;stdio.h&gt=
;</span><br style=3D"font-family: courier new,monospace;"><span style=3D"fo=
nt-family: courier new,monospace;">#include &lt;glib/gi18n.h&gt;</span><br =
style=3D"font-family: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">G_BEGIN_DECLS</span><br style=3D"font-family: co=
urier new,monospace;"><br style=3D"font-family: courier new,monospace;"><sp=
an style=3D"font-family: courier new,monospace;">typedef struct {</span><br=
 style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 GObjectClass parent=
_class;</span><br style=3D"font-family: courier new,monospace;"><span style=
=3D"font-family: courier new,monospace;">=A0 DBusGConnection *connection;</=
span><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">} CheeseDbusClass;</spa=
n><br style=3D"font-family: courier new,monospace;"><br style=3D"font-famil=
y: courier new,monospace;"><span style=3D"font-family: courier new,monospac=
e;">typedef struct _CheeseDbus {</span><br style=3D"font-family: courier ne=
w,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 GObject parent;</sp=
an><br style=3D"font-family: courier new,monospace;"><span style=3D"font-fa=
mily: courier new,monospace;">} CheeseDbus;</span><br style=3D"font-family:=
 courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">#define CHEESE_TYPE_DBUS (cheese_dbus_get_type (=
))</span><br style=3D"font-family: courier new,monospace;"><span style=3D"f=
ont-family: courier new,monospace;">#define CHEESE_DBUS_GET_CLASS(obj)=A0 (=
G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_DBUS, CheeseDbusClass))</span=
><br style=3D"font-family: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">GType=A0=A0=A0=A0=A0=A0 cheese_dbus_get_type (vo=
id);</span><br style=3D"font-family: courier new,monospace;"><span style=3D=
"font-family: courier new,monospace;">CheeseDbus *cheese_dbus_new (void);</=
span><br style=3D"font-family: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">void=A0=A0=A0=A0 cheese_dbus_set_window (gpointe=
r);</span><br style=3D"font-family: courier new,monospace;"><span style=3D"=
font-family: courier new,monospace;">gboolean cheese_dbus_notify (void);</s=
pan><br style=3D"font-family: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">G_END_DECLS</span><br style=3D"font-family: cour=
ier new,monospace;"><br style=3D"font-family: courier new,monospace;"><span=
 style=3D"font-family: courier new,monospace;">G_BEGIN_DECLS</span><br styl=
e=3D"font-family: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">#define g_marshal_value_peek_pointer(v)=A0 (v)-&=
gt;data[0].v_pointer</span><br style=3D"font-family: courier new,monospace;=
"><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">extern void dbus_glib_m=
arshal_cheese_dbus_BOOLEAN__POINTER (GClosure=A0=A0=A0=A0 *closure,</span><=
br style=3D"font-family: courier new,monospace;"><span style=3D"font-family=
: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 GValue=A0=A0=A0=A0=
=A0=A0 *return_value,</span><br style=3D"font-family: courier new,monospace=
;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 guint=A0=A0=A0=A0=A0=A0=A0=A0 n_param_values,</span><br style=3D"fon=
t-family: courier new,monospace;"><span style=3D"font-family: courier new,m=
onospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 const GValue *param_values,</span><=
br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 gpointer=A0=A0=A0=A0=A0 invocation_hint,</span><br style=3D"font-fam=
ily: courier new,monospace;"><span style=3D"font-family: courier new,monosp=
ace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 gpointer=A0=A0=A0=A0=A0 marshal_data);</s=
pan><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">void</span><br style=3D=
"font-family: courier new,monospace;"><span style=3D"font-family: courier n=
ew,monospace;">dbus_glib_marshal_cheese_dbus_BOOLEAN__POINTER (GClosure=A0=
=A0=A0=A0 *closure,</span><br style=3D"font-family: courier new,monospace;"=
>

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 GValue=A0=A0=A0=A0=A0=A0 *ret=
urn_value G_GNUC_UNUSED,</span><br style=3D"font-family: courier new,monosp=
ace;"><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 guint=A0=A0=A0=A0=A0=A0=
=A0=A0 n_param_values,</span><br style=3D"font-family: courier new,monospac=
e;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 const GValue *param_values,</=
span><br style=3D"font-family: courier new,monospace;"><span style=3D"font-=
family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0 gpointer=A0=A0=A0=A0=A0 invocation_hint G_GNUC_UNU=
SED,</span><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 gpointer=A0=A0=A0=A0=A0 marsh=
al_data)</span><br style=3D"font-family: courier new,monospace;"><span styl=
e=3D"font-family: courier new,monospace;">{</span><br style=3D"font-family:=
 courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 typedef gboolean (*=
GMarshalFunc_BOOLEAN__POINTER) (gpointer=A0=A0=A0=A0 data1,</span><br style=
=3D"font-family: courier new,monospace;"><span style=3D"font-family: courie=
r new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0 gpointer=A0=A0=A0=A0 arg_1,</span><br style=3D"fon=
t-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 gpointer=A0=A0=
=A0=A0 data2);</span><br style=3D"font-family: courier new,monospace;"><spa=
n style=3D"font-family: courier new,monospace;">=A0 register GMarshalFunc_B=
OOLEAN__POINTER callback;</span><br style=3D"font-family: courier new,monos=
pace;">

<span style=3D"font-family: courier new,monospace;">=A0 register GCClosure =
*cc =3D (GCClosure*) closure;</span><br style=3D"font-family: courier new,m=
onospace;"><span style=3D"font-family: courier new,monospace;">=A0 register=
 gpointer data1, data2;</span><br style=3D"font-family: courier new,monospa=
ce;">

<span style=3D"font-family: courier new,monospace;">=A0 gboolean v_return;<=
/span><br style=3D"font-family: courier new,monospace;"><br style=3D"font-f=
amily: courier new,monospace;"><span style=3D"font-family: courier new,mono=
space;">=A0 g_return_if_fail (return_value !=3D NULL);</span><br style=3D"f=
ont-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 g_return_if_fail (n=
_param_values =3D=3D 2);</span><br style=3D"font-family: courier new,monosp=
ace;"><br style=3D"font-family: courier new,monospace;"><span style=3D"font=
-family: courier new,monospace;">=A0 if (G_CCLOSURE_SWAP_DATA (closure))</s=
pan><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 {</span><br s=
tyle=3D"font-family: courier new,monospace;"><span style=3D"font-family: co=
urier new,monospace;">=A0=A0=A0=A0=A0 data1 =3D closure-&gt;data;</span><br=
 style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0 data2 =
=3D g_value_peek_pointer (param_values + 0);</span><br style=3D"font-family=
: courier new,monospace;"><span style=3D"font-family: courier new,monospace=
;">=A0=A0=A0 }</span><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 else</span><br styl=
e=3D"font-family: courier new,monospace;"><span style=3D"font-family: couri=
er new,monospace;">=A0=A0=A0 {</span><br style=3D"font-family: courier new,=
monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0 data1 =
=3D g_value_peek_pointer (param_values + 0);</span><br style=3D"font-family=
: courier new,monospace;"><span style=3D"font-family: courier new,monospace=
;">=A0=A0=A0=A0=A0 data2 =3D closure-&gt;data;</span><br style=3D"font-fami=
ly: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 }</span><br s=
tyle=3D"font-family: courier new,monospace;"><span style=3D"font-family: co=
urier new,monospace;">=A0 callback =3D (GMarshalFunc_BOOLEAN__POINTER) (mar=
shal_data ? marshal_data : cc-&gt;callback);</span><br style=3D"font-family=
: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">=A0 v_return =3D callback (data1,</span><br styl=
e=3D"font-family: courier new,monospace;"><span style=3D"font-family: couri=
er new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 g_marshal_value_peek_pointer (param_values + 1),</span><br sty=
le=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 data2);</span><br style=3D"fo=
nt-family: courier new,monospace;"><br style=3D"font-family: courier new,mo=
nospace;"><span style=3D"font-family: courier new,monospace;">=A0 g_value_s=
et_boolean (return_value, v_return);</span><br style=3D"font-family: courie=
r new,monospace;">

<span style=3D"font-family: courier new,monospace;">}</span><br style=3D"fo=
nt-family: courier new,monospace;"><br style=3D"font-family: courier new,mo=
nospace;"><span style=3D"font-family: courier new,monospace;">G_END_DECLS</=
span><br style=3D"font-family: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">static const DBusGMethodInfo dbus_glib_cheese_db=
us_methods[] =3D {</span><br style=3D"font-family: courier new,monospace;">=
<span style=3D"font-family: courier new,monospace;">=A0 { (GCallback) chees=
e_dbus_notify, dbus_glib_marshal_cheese_dbus_BOOLEAN__POINTER, 0 },</span><=
br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">};</span><br style=3D"f=
ont-family: courier new,monospace;"><br style=3D"font-family: courier new,m=
onospace;"><span style=3D"font-family: courier new,monospace;">const DBusGO=
bjectInfo dbus_glib_cheese_dbus_object_info =3D {</span><br style=3D"font-f=
amily: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 0,</span><br style=
=3D"font-family: courier new,monospace;"><span style=3D"font-family: courie=
r new,monospace;">=A0 dbus_glib_cheese_dbus_methods,</span><br style=3D"fon=
t-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 1,</span><br style=
=3D"font-family: courier new,monospace;"><span style=3D"font-family: courie=
r new,monospace;">&quot;org.gnome.Cheese\0notify\0S\0\0\0&quot;,</span><br =
style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">&quot;\0&quot;,</span><=
br style=3D"font-family: courier new,monospace;"><span style=3D"font-family=
: courier new,monospace;">&quot;\0&quot;</span><br style=3D"font-family: co=
urier new,monospace;">

<span style=3D"font-family: courier new,monospace;">};</span><br style=3D"f=
ont-family: courier new,monospace;"><br style=3D"font-family: courier new,m=
onospace;"><span style=3D"font-family: courier new,monospace;">gpointer win=
dow_pointer;</span><br style=3D"font-family: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">G_DEFINE_TYPE (CheeseDbus, cheese_dbus, G_TYPE_O=
BJECT);</span><br style=3D"font-family: courier new,monospace;"><br style=
=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">void cheese_dbus_set_wi=
ndow (gpointer data) {</span><br style=3D"font-family: courier new,monospac=
e;"><span style=3D"font-family: courier new,monospace;">=A0 if (data !=3D N=
ULL)</span><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 window_pointe=
r =3D data;</span><br style=3D"font-family: courier new,monospace;"><span s=
tyle=3D"font-family: courier new,monospace;">}</span><br style=3D"font-fami=
ly: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">gboolean cheese_dbus_notify () {</span><br style=
=3D"font-family: courier new,monospace;"><span style=3D"font-family: courie=
r new,monospace;">=A0 return TRUE;</span><br style=3D"font-family: courier =
new,monospace;">

<span style=3D"font-family: courier new,monospace;">}</span><br style=3D"fo=
nt-family: courier new,monospace;"><br style=3D"font-family: courier new,mo=
nospace;"><span style=3D"font-family: courier new,monospace;">void cheese_d=
bus_class_init (CheeseDbusClass *klass) {</span><br style=3D"font-family: c=
ourier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 GError *error =3D N=
ULL;</span><br style=3D"font-family: courier new,monospace;"><br style=3D"f=
ont-family: courier new,monospace;"><span style=3D"font-family: courier new=
,monospace;">=A0 /* Init the DBus connection, per-klass */</span><br style=
=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 klass-&gt;connectio=
n =3D dbus_g_bus_get (DBUS_BUS_SESSION, &amp;error);</span><br style=3D"fon=
t-family: courier new,monospace;"><span style=3D"font-family: courier new,m=
onospace;">=A0 if (klass-&gt;connection =3D=3D NULL) {</span><br style=3D"f=
ont-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 g_warning (&q=
uot;Unable to connect to dbus: %s&quot;, error-&gt;message);</span><br styl=
e=3D"font-family: courier new,monospace;"><span style=3D"font-family: couri=
er new,monospace;">=A0=A0=A0 g_error_free (error);</span><br style=3D"font-=
family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 return;</span=
><br style=3D"font-family: courier new,monospace;"><span style=3D"font-fami=
ly: courier new,monospace;">=A0 }</span><br style=3D"font-family: courier n=
ew,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">=A0 dbus_g_object_type_install_info (CHEESE_TYPE=
_DBUS, &amp;dbus_glib_cheese_dbus_object_info);</span><br style=3D"font-fam=
ily: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">}</span><br style=3D"fo=
nt-family: courier new,monospace;"><br style=3D"font-family: courier new,mo=
nospace;"><span style=3D"font-family: courier new,monospace;">void cheese_d=
bus_init (CheeseDbus *server) {</span><br style=3D"font-family: courier new=
,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 CheeseDbusClass *kl=
ass =3D CHEESE_DBUS_GET_CLASS (server);</span><br style=3D"font-family: cou=
rier new,monospace;"><br style=3D"font-family: courier new,monospace;"><spa=
n style=3D"font-family: courier new,monospace;">=A0 /* Register DBUS path *=
/</span><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 dbus_g_connection_r=
egister_g_object (klass-&gt;connection, &quot;/org/gnome/cheese&quot;, G_OB=
JECT (server));</span><br style=3D"font-family: courier new,monospace;"><sp=
an style=3D"font-family: courier new,monospace;">}</span><br style=3D"font-=
family: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">CheeseDbus* cheese_dbus_new () {</span><br style=
=3D"font-family: courier new,monospace;"><span style=3D"font-family: courie=
r new,monospace;">=A0 CheeseDbus=A0=A0=A0=A0=A0 *server;</span><br style=3D=
"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 GError=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 *error =3D NULL;</span><br style=3D"font-family: courier ne=
w,monospace;"><span style=3D"font-family: courier new,monospace;">=A0 DBusG=
Proxy=A0=A0=A0=A0=A0 *proxy;</span><br style=3D"font-family: courier new,mo=
nospace;">

<span style=3D"font-family: courier new,monospace;">=A0 guint=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 request_ret;</span><br style=3D"font-family: courier =
new,monospace;"><span style=3D"font-family: courier new,monospace;">=A0 Che=
eseDbusClass *klass;</span><br style=3D"font-family: courier new,monospace;=
">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">=A0 server =3D g_object_new (CHEESE_TYPE_DBUS, N=
ULL);</span><br style=3D"font-family: courier new,monospace;"><br style=3D"=
font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 klass =3D CHEESE_DB=
US_GET_CLASS (server);</span><br style=3D"font-family: courier new,monospac=
e;"><br style=3D"font-family: courier new,monospace;"><span style=3D"font-f=
amily: courier new,monospace;">=A0 /* Register the service name, the consta=
nt here are defined in dbus-glib-bindings.h */</span><br style=3D"font-fami=
ly: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 proxy =3D dbus_g_pr=
oxy_new_for_name (klass-&gt;connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, =
DBUS_INTERFACE_DBUS);</span><br style=3D"font-family: courier new,monospace=
;">
<br style=3D"font-family: courier new,monospace;">
<span style=3D"font-family: courier new,monospace;">=A0 if (!org_freedeskto=
p_DBus_request_name (proxy, &quot;org.gnome.Cheese&quot;, 0, &amp;request_r=
et, &amp;error)) {</span><br style=3D"font-family: courier new,monospace;">=
<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 g_warning (&q=
uot;Unable to register service: %s&quot;, error-&gt;message);</span><br sty=
le=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 g_error_free =
(error);</span><br style=3D"font-family: courier new,monospace;"><span styl=
e=3D"font-family: courier new,monospace;">=A0 }</span><br style=3D"font-fam=
ily: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">=A0 /* check if there is already a instance runn=
ing -&gt; exit*/</span><br style=3D"font-family: courier new,monospace;"><s=
pan style=3D"font-family: courier new,monospace;">=A0 if (request_ret =3D=
=3D DBUS_REQUEST_NAME_REPLY_EXISTS || request_ret =3D=3D DBUS_REQUEST_NAME_=
REPLY_IN_QUEUE) {</span><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 g_warning (&q=
uot;Another instance of cheese is already running!&quot;);</span><br style=
=3D"font-family: courier new,monospace;"><span style=3D"font-family: courie=
r new,monospace;">=A0=A0=A0 </span><br style=3D"font-family: courier new,mo=
nospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 /* notify the=
 other instance of cheese*/</span><br style=3D"font-family: courier new,mon=
ospace;"><span style=3D"font-family: courier new,monospace;">=A0=A0=A0 prox=
y =3D dbus_g_proxy_new_for_name (klass-&gt;connection, &quot;org.gnome.Chee=
se&quot;, &quot;/org/gnome/cheese&quot;, &quot;org.gnome.Cheese&quot;);</sp=
an><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 </span><br st=
yle=3D"font-family: courier new,monospace;"><span style=3D"font-family: cou=
rier new,monospace;">=A0=A0=A0 if (!dbus_g_proxy_call (proxy, &quot;notify&=
quot;, &amp;error, G_TYPE_INVALID, G_TYPE_INVALID)) {</span><br style=3D"fo=
nt-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0 /* Meth=
od failed, the GError is set, let&#39;s warn everyone */</span><br style=3D=
"font-family: courier new,monospace;"><span style=3D"font-family: courier n=
ew,monospace;">=A0=A0=A0=A0=A0 g_warning (&quot;Notifying the other cheese =
instance failed: %s&quot;, error-&gt;message);</span><br style=3D"font-fami=
ly: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0 g_error=
_free (error);</span><br style=3D"font-family: courier new,monospace;"><spa=
n style=3D"font-family: courier new,monospace;">=A0=A0=A0 }</span><br style=
=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 </span><br st=
yle=3D"font-family: courier new,monospace;"><span style=3D"font-family: cou=
rier new,monospace;">=A0=A0=A0 g_object_unref (server);</span><br style=3D"=
font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 server =3D NU=
LL;</span><br style=3D"font-family: courier new,monospace;"><span style=3D"=
font-family: courier new,monospace;">=A0 }</span><br style=3D"font-family: =
courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 </span><br style=3D=
"font-family: courier new,monospace;"><span style=3D"font-family: courier n=
ew,monospace;">=A0 g_object_unref (proxy);</span><br style=3D"font-family: =
courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 </span><br style=3D=
"font-family: courier new,monospace;"><span style=3D"font-family: courier n=
ew,monospace;">=A0 return server;</span><br style=3D"font-family: courier n=
ew,monospace;">

<span style=3D"font-family: courier new,monospace;">}</span><br style=3D"fo=
nt-family: courier new,monospace;"><br style=3D"font-family: courier new,mo=
nospace;"><span style=3D"font-family: courier new,monospace;">int main (int=
 argc, char **argv) {</span><br style=3D"font-family: courier new,monospace=
;">

<span style=3D"font-family: courier new,monospace;">=A0 CheeseDbus *dbus_se=
rver;</span><br style=3D"font-family: courier new,monospace;"><span style=
=3D"font-family: courier new,monospace;">=A0 </span><br style=3D"font-famil=
y: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 g_thread_init (NULL=
);</span><br style=3D"font-family: courier new,monospace;"><span style=3D"f=
ont-family: courier new,monospace;">=A0 </span><br style=3D"font-family: co=
urier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 dbus_server =3D che=
ese_dbus_new ();</span><br style=3D"font-family: courier new,monospace;"><s=
pan style=3D"font-family: courier new,monospace;">=A0 if (dbus_server =3D=
=3D NULL) {</span><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0=A0=A0 printf(&quot;=
failed\n&quot;);</span><br style=3D"font-family: courier new,monospace;"><s=
pan style=3D"font-family: courier new,monospace;">=A0=A0=A0 return -1;</spa=
n><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 }</span><br style=
=3D"font-family: courier new,monospace;"><span style=3D"font-family: courie=
r new,monospace;">=A0 </span><br style=3D"font-family: courier new,monospac=
e;"><span style=3D"font-family: courier new,monospace;">=A0 printf(&quot;su=
ccess\n&quot;);</span><br style=3D"font-family: courier new,monospace;">

<span style=3D"font-family: courier new,monospace;">=A0 return 0;</span><br=
 style=3D"font-family: courier new,monospace;"><span style=3D"font-family: =
courier new,monospace;">}</span><br>--------------------<br><br><br>The out=
put I get is this:<br>

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">$ ./cheese</span><br style=3D"font-family: couri=
er new,monospace;"><br style=3D"font-family: courier new,monospace;"><span =
style=3D"font-family: courier new,monospace;">(process:22856): GLib-GObject=
-CRITICAL **: /build/buildd/glib2.0-2.18.2/gobject/gtype.c:2458: initializa=
tion assertion failed, use IA__g_type_init() prior to this function</span><=
br style=3D"font-family: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">(process:22856): GLib-CRITICAL **: g_once_init_l=
eave: assertion `initialization_value !=3D 0&#39; failed</span><br style=3D=
"font-family: courier new,monospace;">

<br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
y: courier new,monospace;">(process:22856): GLib-GObject-CRITICAL **: g_obj=
ect_new: assertion `G_TYPE_IS_OBJECT (object_type)&#39; failed</span><br><b=
r>

<br><br>Using gdb, I find that the error lies on line 131 (originally on li=
ne 94 in cheese-dbus.c) which is the one that says &quot;server =3D g_objec=
t_new (CHEESE_TYPE_DBUS, NULL);&quot;<br><br><br>Any idea what the problem =
is?<br>

<br>Regards<br>Jostein A. Jacobsen<br>
<br>

--0016e6de0033b47cf904650441e8--


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