Re: Weird pointer error.



On Wed, 2004-10-27 at 23:12, Leo Przybylski wrote:
Hello,

I got my GtkNotebook working. I have a new problem now. I have created a 
structure to store the GtkNotebook *, but whenever I try to set the 
pointer with:

GtkWidget * notebook
notebook = gtk_notebook_new();
widget_s->notebook = notebook;

... I get numerous errors:

The errors above means you are trying to use functions that expect a
g_object (all gtk_widgets are g_objects) with a NULL pointer or a non
g_object pointer.

Will be much easier to help you if you post some code, or points to a
link to the code, as with no code it's really difficult to figure where
the error is.

Try this:

typedef struct _MyStruct {
        GtkWidget* notebook;
} MyStruct;

MyStruct* widget_s = g_malloc0(sizeof(MyStruct)); 
widget_s->notebook = gtk_notebook_new();

(console:24261): GLib-GObject-CRITICAL **: file gobject.c: line 1561 
(g_object_ref): assertion `G_IS_OBJECT (object)' failed

[snip]

I found that i get the same even when I use:
widget_s->notebook  = 0;

0 == NULL

Apparently, somewhere, something is looking for widget_s->notebook and 
maybe there are initialization problems. I'm clueless on this.

Me too because you did not post the initiallization code.

This application works better if I don't reinitialize widget_s->notebook 
or when I remove notebook from the widget_s struct.

Where did you initiallized widget_s->notebook at the first time ?

Any ideas?

Please, post some code.
-- 
Iago Rubio   



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