[BLACKBOX] GdkGC *fg_gc[5] in CP?

From: [at]} <Frank>
Date: Sat, 19 Mar 2011 23:45:51 -0300

----boundary-LibPST-iamunique-21293906_-_-
Content-type: text/plain

I am still struggling with my simple test program which shall implement
a gtk expose signal handler.

Following earlier recommendations to experiment, my expose signal
handler now starts as:

-----------------------------------------------------------------------
PROCEDURE [ccall] Expose (widget: Gtk.WidgetP; event: Gdk.EventExposeP;
        data: G.pointer): G.boolean;
VAR gc: Gdk.GCP;
     style: Gtk.StyleP;
BEGIN
   Out.String("widget.state="); Out.Int(ORD(widget.state),0); Out.Ln;
   Out.String("allocation: "); Out.Int (widget.allocation.width, 0);
   Out.String(", "); Out.Int (widget.allocation.height, 0); Out.Ln;
   style:= widget.style;
   gc:= style.fg_gc[0];
   ...
-----------------------------------------------------------------------

When I call my program, widget.state and allocation width and height are
written correctly to the log and a trap "illegal memory read" is
generated (see below). Clicking on the diamond marks last shown line of
"Expose" above.

The original declaration of GtkStyle in gtkstyle.h is
-----------------------------------------------------------------------
struct _GtkStyle
{
   GObject parent_instance;

   /*< public >*/

   GdkColor fg[5];
   GdkColor bg[5];
   GdkColor light[5];
   GdkColor dark[5];
   GdkColor mid[5];
   GdkColor text[5];
   GdkColor base[5];
   GdkColor text_aa[5]; /* Halfway between text/base */

   GdkColor black;
   GdkColor white;
   PangoFontDescription *font_desc;

   gint xthickness;
   gint ythickness;

   GdkGC *fg_gc[5];
   GdkGC *bg_gc[5];
   GdkGC *light_gc[5];
   GdkGC *dark_gc[5];
   GdkGC *mid_gc[5];
   GdkGC *text_gc[5];
   GdkGC *base_gc[5];
   GdkGC *text_aa_gc[5];
   GdkGC *black_gc;
   GdkGC *white_gc;

   GdkPixmap *bg_pixmap[5];

   /*< private >*/

   gint attach_count;

   gint depth;
   GdkColormap *colormap;
   GdkFont *private_font;
   PangoFontDescription *private_font_desc; /* Font description for
style->private_font or %NULL */

   /* the RcStyle from which this style was created */
   GtkRcStyle *rc_style;

   GSList *styles; /* of type GtkStyle* */
   GArray *property_cache;
   GSList *icon_factories; /* of type GtkIconFactory* */
};
----------------------------------------------------------------------

which I translated to

-----------------------------------------------------------------------
   StyleP* = POINTER TO Style;
   Style* = EXTENSIBLE RECORD [noalign] (G.Object)
     fg*, bg*, light*, dark*, mid*, text*, base*, text_aa*:
                POINTER TO ARRAY [untagged] 5 OF Gdk.Color;
     black*, white*: Gdk.Color;
     font_desc*: Pango.FontDescriptionP;
     xthickness*, ythickness*: G.int;
     fg_gc*, bg_gc*, light_gc*, dark_gc*, mid_gc*, text_gc*, base_gc*,
     text_aa_gc*: POINTER TO ARRAY [untagged] 5 OF Gdk.GCP;
     black_gc*, white_gc*: Gdk.GCP;
     bg_pixmap*: POINTER TO ARRAY [untagged] 5 OF Gdk.PixmapP;
     attach_count*, depth*: G.int;
     colormap*: Gdk.ColormapP;
     private_font*: Gdk.FontP;

     private_font_desc*: Pango.FontDescriptionP;
     rc_style*: RcStyleP;
     styles*: G.SListP;

     property_cache*: G.ArrayGP;

     icon_factories*: G.SListP;
   END;
---------------------------------------------------------------------------

So I guess:

As the line "gc:= style.fg_gc[0];" is marked, the error is in my
translation of
        "GdkGC *fg_gc[5];"
to
        "POINTER TO ARRAY [untagged] 5 OF Gdk.GCP;"
where Gdk.GCP is declares pointer to Gdk.GC.

Is that correct? What else can I do to track down the error?


        


-- 
Frank Hrebabetzky		+55 / 48 / 3235 1106
Florianopolis, Brazil
----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-21293906_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0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tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxwYXINClxwYXINClNvIEkgZ3Vlc3M6XHBhcg0KXHBh
cg0KQXMgdGhlIGxpbmUgImdjOj0gc3R5bGUuZmdfZ2NbMF07IiBpcyBtYXJrZWQsIHRoZSBlcnJv
ciBpcyBpbiBteSBccGFyDQp0cmFuc2xhdGlvbiBvZlxwYXINClx0YWIgIkdka0dDICpmZ19nY1s1
XTsiXHBhcg0KdG9ccGFyDQpcdGFiICJQT0lOVEVSIFRPIEFSUkFZIFt1bnRhZ2dlZF0gNSBPRiBH
ZGsuR0NQOyJccGFyDQp3aGVyZSBHZGsuR0NQIGlzIGRlY2xhcmVzIHBvaW50ZXIgdG8gR2RrLkdD
LlxwYXINClxwYXINCklzIHRoYXQgY29ycmVjdD8gV2hhdCBlbHNlIGNhbiBJIGRvIHRvIHRyYWNr
IGRvd24gdGhlIGVycm9yP1xwYXINClxwYXINClxwYXINClx0YWIgXHBhcg0KXHBhcg0KXHBhcg0K
LS0gXHBhcg0KRnJhbmsgSHJlYmFiZXR6a3lcdGFiIFx0YWIgKzU1IC8gNDggLyAzMjM1IDExMDZc
cGFyDQpGbG9yaWFub3BvbGlzLCBCcmF6aWxccGFyDQpccGFyDQpccGFyDQotLS0tXHBhcg0KVG8g
dW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAiU0lHTk9GRiBCTEFDS0JPWCIg
dG8gTElTVFNFUlZATElTVFMuT0JFUk9OLkNIfX0AAX8AMA==
----boundary-LibPST-iamunique-21293906_-_---
Received on Sun Mar 20 2011 - 03:45:51 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:16 UTC