bug in gtk_signal_emit_by_name




Hi,

One of the users of GtkAda as reported a bug in gtk_signal_emit_by_name.
Here is a small test case that reproduces the problem.
Note that apparently the bug is specific to "expose_event", since it does not
appear with other events like "leave".
Let me know if I should report this bug to another mailing list.

Emmanuel

/* Compile with :
   gcc `gtk-config --cflags` project2.c `gtk-config --libs`

   This program core dumps when the button is pressed...
   This seems to be because of "expose_event". It works with for instance
   "leave".
*/

#include <gtk/gtk.h>
#include <stdio.h>

void
on_clicked (GtkObject* obj, GtkDrawingArea draw)
{
  printf ("on_clicked\n");
  gtk_signal_emit_by_name ((GtkObject*)obj, "expose_event");
  printf ("leave\n");
}

int
main (int argc, char *argv[])
{
  GtkWindow* win;
  GtkButton* button1;

  gtk_set_locale();
  gtk_init (&argc, &argv);

  win = (GtkWindow*) gtk_window_new (GTK_WINDOW_TOPLEVEL);
  button1 = (GtkButton*) gtk_button_new_with_label ("button1");
  gtk_container_add ((GtkContainer*)win, (GtkWidget*) button1);

  (void) gtk_signal_connect ((GtkObject*)button1,
                             "clicked",
                             (GtkSignalFunc)&on_clicked,
                             (gpointer)button1);

  gtk_widget_show_all ((GtkWidget*)win);
  gtk_main ();
  return 1;
}



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