Re: Abend with gdk_gc_new_with_values



Bryan Brown wrote:

Hello,

When I was using the version of gtk/gdk that came with RedHat 7 my app
worked fine when I used the following code snippet to set the values in a
new graphics context from those in another:

=== begin code snippet ===

  GtkWidget *drawingarea1;
  GdkGCValues values;
  GdkGCValuesMask mask;
  GdkGC *gc_fg;

  gdk_gc_get_values (drawingarea1->style->fg_gc[GTK_WIDGET_STATE
(drawingarea1)],
                     &values);

  mask = (GDK_GC_FOREGROUND) | (GDK_GC_BACKGROUND) | (GDK_GC_FONT) |
(GDK_GC_FUNCTION) | (GDK_GC_FILL);

  gc_fg = gdk_gc_new_with_values (drawingarea1->window, &values, mask);

=== end code snippet ===

With the versions that came with my RedHat 9 CD, however, the app abends
inside the call to gdk_gc_new_with_values (inserting printf statements
before and after the call shows this) with a segmentation fault.

As a workaround I've resorted to using gdk_gc_new(-) and setting the
values individually, but I'd really like to know what I'm doing wrong.

Hi,
To solve your problem, remove GDK_GC_FONT mask before calling gdk_gc_new_with_values().

Just filled
http://bugzilla.gnome.org/show_bug.cgi?id=134202

PS: please tell about version of GTK and distro you're using - for example RedHat 7.3 have gtk+-1.2.10 and gtk+-2.0.2.

   Olexiy




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