problem using gtk_color_button_get_color



Hello,

when I used gtk_color_button_get_color 2 times I get a segfault.
so I made a simple example with glade.

here is the click-event for a button.
when I click this button 2 times I get a segfault.

void
on_button1_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{
  GdkColor *color;
  GtkWidget *w;

  w=lookup_widget (GTK_WIDGET (button), "colorbutton1");
  gtk_color_button_get_color ((GtkColorButton *)w, color);

  w=lookup_widget (GTK_WIDGET (button), "label1");
  gtk_widget_modify_fg (w, GTK_STATE_ACTIVE, color);
  gtk_widget_modify_fg (w, GTK_STATE_NORMAL, color);

}

here the complete example as src-package:
http://pub.vocwiki.net/colorbutton.tar.bz2

I'm using GTK 2.4.3 on a Slackware 10.

I tested it on another computer with FC2 and a more up to date GTK (2.4.14) 
and I got this error:
(colorbutton:11760): GLib-GObject-CRITICAL **: file gclosure.c: line 421 
(g_closure_invoke): assertion `closure->marshal || closure->meta_marshal' 
failed

Whats wrong with the code? 
Am I not allowed to use gtk_color_button_get_color more than once?

-- 
<>< Andreas Madsack



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