Re: Creating my own widget (err: class is smaller than its parent class)



you haven't left space for the parents instance struct in your one 

struct _GtkCodeText{
};

should be 

struct _GtkCodeText
{
	GtkText gtkText;
};

Also your files are named crazily 

GtkCodeText.h should be GtkCodeText.c
GtkCodeText_in.h should be GtkCodeText.h

(though it dosen't really matter what you call them it confuses other
people that have to look at them)
 
You also shouldn't use the Gtk prefix for you own classes as there is a
possibilty that it might clash with a name from gtk

hope this helps

On Sat, 2002-01-19 at 14:47, Philip Van Hoof wrote:
> 
> 
> Hi there,
> 
> I am trying to write my own gtk widget
> and I am having a few problems.
> 
> These are the three files that I am working on
> in case you want to checkout the code :
> 
> http://freax.eu.org/files/GtkCodeText.h
> http://freax.eu.org/files/GtkCodeText_in.h
> http://freax.eu.org/files/example.c
> 
> 
> I followed the example and tutorial at
> <http://www.gtk.org/tutorial/sec-creatingacompositewidget.html>
> 
> During compilation of example.c I get no compilation errors nor 
> warnings. But when I start my example program; I get this error :
> 
> "Gtk-WARNING **: The `GtkCodeText' class is smaller than its parent 
> class `GtkText'."
> 
> I am using GtkText as parent class in stead of the
> gtkvbox in the example and changed the GtkTypeInfo function as
> described on <http://www.gtk.org/gtk+-1.2-Changes.html>
> 
> What am I doing wrong here ?
> 
> [root pluisje codecomp]# gcc example.c -ggdb `gtk-config --cflags 
> --libs`
> [root pluisje codecomp]# ./a.out Gtk-WARNING **: The `GtkCodeText' 
> class is smaller than its parent class `GtkText'
> Segmentation fault (core dumped)
> [root pluisje codecomp]# 
> 
> -- 
> Philip van Hoof aka freax (http://www.freax.eu.org)
> irc: irc.openprojects.net mailto:freax @ linux.be
> _______________________________________________
> gnome-devel-list mailing list
> gnome-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-devel-list
> 
-- 

rob




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