[Glade-users] gtk_menu_popup Segmentation Fault



OK, so my problem is not really solved (see my posts yesterday), but let me
rephrase the question, since I think I have a better idea what the real
problem is now:

I have a popup menu that I want to call every time I right-click.  It works
until I try to add an additional window to my glade project.  The act of
saving the glade project with that new window breaks the program (it's not
even referenced in the code yet).  After that, whenever I right click in the
area where I should get a popup, my program dies in a segmentation fault.
Removing the additional window from the glade project and saving it fixes
the problem, but I'd really like to have that window!  I'm using glade-2.

Here is the code where it dies, the debug printfs print up to the "3":

gint on_glarea_button_press_event (GtkWidget *widget, GdkEvent *event){
  GdkEventButton *event_button = (GdkEventButton *)event;

  g_return_val_if_fail (widget != NULL, FALSE);
  g_returnval_if_fail (GTK_IS_MENU (widget), FALSE);
  g_return_val_if_fail (event != NULL, FALSE);

  printf("1\n");
  if (event_button->button == 3 && event->type == GDK_BUTTON_PRESS){
    printf("%d\n",event_button->button);
    printf("%d\n",event_button->time);  /* segfaults after this line */
    gtk_menu_popup(GTK_MENU (widget) , NULL, NULL, NULL, NULL,
event_button->button, event_button->time);
    printf("3\n");  /* segfault before this line */
    return TRUE;
  }

  return FALSE;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20070425/ff2a60c5/attachment.html 




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