[gtk-list] Bug in delivering of delete_event gtk-99.2??



Hi,

I'm just starting with GTK and I think I found a bug. The pointer to
user data passed into
the callback routine for "delete_event" signal seems to be garbage. I'm
using GTK 99.2.

Here is an example:

#include <gtk/gtk.h>

void hello (GtkWidget *widget, gpointer data)
{
  g_print ("Hello world\n");
  g_print ("p=%d data=%s \n", data, (char *)data);
}

void  delete_event (GtkWidget *widget, gpointer data)
{
  /*** Bug???
    "data" seems to be garbage in this routine
  ***/
  g_print ("Delete event occured \n");
  g_print ("p=%d data=%s \n", data, (char *)data);
  gtk_main_quit ();
}

int main (int argc, char *argv [])
{
  GtkWidget *window;
  GtkWidget *button;
  char *string = "abcdef";

  g_print ("Address of string=%d \n", string);

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_signal_connect (GTK_OBJECT(window), "delete_event",
       GTK_SIGNAL_FUNC (delete_event), string);

  gtk_container_border_width (GTK_CONTAINER (window), 10);

  button = gtk_button_new_with_label ("Hello World!!!");
  gtk_signal_connect (GTK_OBJECT (button), "clicked",
       GTK_SIGNAL_FUNC (hello), string);



  gtk_container_add (GTK_CONTAINER (window), button);
  gtk_widget_show (button);
  gtk_widget_show (window);
  gtk_main ();
  return 0;

}


And here is the output when running this program:


[nrichieb on idoru] gtk > bug
Address of string=134517451
Hello world
p=134517451 data=abcdef
Hello world
p=134517451 data=abcdef
Delete event occured
p=134656168 data=                <------ This pointer is wrong.
[nrichieb on idoru] gtk >



Is there a patch for this bug already? I'm not sure where to look in the
gtk code.

...richie


--
* richieb@netlabs.net       - at home |  Richie Bielak          *
* richieb@calfp.com         - at work |                         *
*         Home page:   http://www.netlabs.net/hp/richieb        *
*         Fight software piracy, use free software! (me)        *





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