[lazarus] GTK Strangeness

Peter Vreman pfvreman at wins.uva.nl
Mon Jul 12 06:18:01 EDT 1999


At 06:33 12-7-99 , you wrote:
>Does anyone know who did the GTK conversion? The reason I am wondering is that
>I think I may have found a bug.
>
>I found some method calls that take a Pgchar as input and if you pass a long
>string to them, they get a bunch of errors and don't work. If you typecast the
>string to a ShortString, they work perfectly. Yet other procedures that take a
>Pgchar work with long strings just fine.
>
>For example, here is what I am talking about.
>
>mmiFile := gtk_menu_item_new_with_label ('');
>tmp_key :=gtk_label_parse_uline(GTK_LABEL(GTK_BIN(mmiFile).child), '_File');
>gtk_widget_add_accelerator(mmiFile, 'activate_item', accel_group,
>                       tmp_key, gint(GDK_MOD1_MASK), TGtkAccelFlags(0));
>
>All three of these functions require a Pgchar to be passed in (the params with
>single quotes). When I had {$H-} at the top of the unit, everything worked
>fine. As soon as I changed it to {$H+}, the first two functions kicked out a
>bunch of errors and failed at runtime. They compiled just fine. They just
>kicked out all kinds of GTK errors when I ran the program and they didn't 
>work.
>Then when I changed them to the following, they work perfectly again.
>
>mmiFile := gtk_menu_item_new_with_label (ShortString(''));
>tmp_key := gtk_label_parse_uline(GTK_LABEL(GTK_BIN(mmiFile).child),
>ShortString('_File'));
>
>Notice the ShortString in them? The third function did not need to be changed
>at all. It continued to work just fine even with long strings. I can do the
>typecast to fix it for now, but this seems like it is wrong. I checked the
>functions in the gtk files and cannot find anything wrong. So I don't know who
>to report this to. Does anyone else have any ideas how to fix this or who to
>report it to?

Compiler/rtl problems could be mailed to the fpc-devel mailinglist. But 
i'll take a look at it, it looks like a constant ansistring->pchar 
conversion problem.







More information about the Lazarus mailing list