Re: Subclasses
Marco Gidde <[email protected]> Tue, 06 Jun 2006 11:29:43 +0200
| Newsgroups | gmane.lisp.clg.devel |
|---|---|
| Organization | Linux Private Site |
| Message-ID | <[email protected]> |
Hi Espen, sorry for replying to myself, but the previous message was in part nonsensical. Marco Gidde <[email protected]> writes: > As mentioned in my mail reply clg compiles with errors when > +struct-alignmen+ is changed to 4 so I kept the old value and debugged > a bit further. Since I don't know too much about metaclass handling, > understanding the cgl internals is a bit hard for me. As a result I > can almost only describe symptoms which may or may not help you > understand what's going on here. You were right concerning the +struct-alignmen+ with one important exception: 64bit values (like pointers) must lie on 8-byte boundaries so that +struct-alignmen+ not only depends on the previous calculated slots but also on the current slot. For example: int -> offset 0 int -> offset 4 pointer -> offset 8 *but* int -> offset 0 pointer -> offset 8 int -> offset 16 I modified ALIGN-OFFSET and COMPUTE-SLOTS locally to match this requirement, but it looks too ugly to be published here :-/ > First I went on with GINSPECT and found that it worked partially when > I added (:GTYPE "GObject") to the definition of > OBJECT-CONTAINER. After that expanding an item of the tree for the > first time results in a memory fault caused by the call to > TREE-VIEW-EXPAND-ROW. When I simply continue from the callback, > expanding the same item for the second time gives a nice list of all > the slots. The same happens for any expandable tree item: memory fault > for the first click, correct expansion for the second. This effect still remains. > I then tried to inherit a class from DRAWING-AREA with > (:METACLASS GOBJECT-CLASS) > which resulted in the following messages: > > WARNING: > GLib-GObject: specified instance size for type `PlotterPlotter' is smaller than the parent type's `GtkDrawingArea' instance size > WARNING: > GLib-GObject: cannot retrieve class for invalid (unclassed) type `<invalid>' > WARNING: Super class mismatch between CLOS and GObject for PLOTTER > > This messages is produced when REGISTER-NEW-TYPE calls > %TYPE-REGISTER-STATIC and is caused by the fact, that the > INSTANCE-SIZE of GtkDrawingArea as returned in the TYPE-QUERY object > is 0. This is also the case for several other classes I tried > (Gtkwidget, GObject, GtkButton), I suspect it's true for all > classes. If I hard code a large enough value for INSTANCE-SIZE, the > message disappears, so it seems that clg and glib disagree on this > value. The definitions of TYPE-QUERY and TYPE-INFO match the installed > headers. All this vanished with the changed alignment handling as described above. Regards, Marco