Re: Subclasses

Marco Gidde <[email protected]> Mon, 05 Jun 2006 15:07:13 +0200
Newsgroups gmane.lisp.clg.devel
Organization Linux Private Site
Message-ID <[email protected]>
Espen S Johnsen <[email protected]> writes:

> Marco Gidde <[email protected]> writes:
>
>> Hello Espen,
>> 
>> a few month ago you posted an example with a user defined class that
>> inherits from drawing-area. The same technique is used in the examples
>> directory in ginspect.lisp and seems to be broken, at least here :-)
>> 
>> My machine configuration is as follows:
>> 
>> uname -a: Linux tristan 2.6.11.4-21.10-default #1 Tue Nov 29 14:32:49 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux
>> 
>> SBCL 0.9.12 for x86_64
>
> I assume your using 0.93pre and if that is correct this is probably a
> struct alignment error. Try chancing the definition of +struct-alignmen+
> (yes, it's spelling error in the symbol name) in gffi/proxy.lisp to
> 4. Unfortunately I don't have access to an amd64 machine which has all
> the necessary libraries installed so I couldn't test this my self (but
> when I have some spare time I will set up a test environment so that I
> could do regular testing on 64 bit machines)

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.

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.

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.

That's all I can do for now. If you have any further suggestions or
need some more information, I'll be glad to help you.


Regards,

Marco