Subject: pkg/25091: print/ggv2 dumps core
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <hira@po6.nsk.ne.jp>
List: pkgsrc-bugs
Date: 04/08/2004 00:31:16
>Number:         25091
>Category:       pkg
>Synopsis:       print/ggv2 dumps core
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 07 15:32:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Kouichirou Hiratsuka
>Release:        NetBSD 2.0_BETA
>Organization:
>Environment:
System: NetBSD firefly.localdomain 2.0_BETA NetBSD 2.0_BETA (FIREFLY.MP) #1: Wed Apr 7 21:34:43 JST 2004 root@firefly.localdomain:/usr/src/sys/arch/i386/compile/FIREFLY.MP i386
Architecture: i386
Machine: i386
>Description:
	When I hit a return key on print/ggv2, it dumps core.
	In src/ggv-window.c, open_button_pressed_cb() needs check for second
	argument. Because this function is called from line 907 and its
	second argument is NULL.

>How-To-Repeat:
	cd ${PKGSRCDIR}/print/ggv2
	make && make install
	ggv
	(hit a return key on ggv)

>Fix:
	If second argument is NULL, don't use it.

--- src/ggv-window.c.orig	2004-04-07 08:43:53.000000000 +0900
+++ src/ggv-window.c	2004-04-07 08:45:00.000000000 +0900
@@ -883,13 +883,19 @@
                         gpointer *user_data)
 {
         GtkWidget *menu;
+	guint button = 0;
+	guint32 activate_time = GDK_CURRENT_TIME;
                                                                                                                              
         g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE); 
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); 
 
 	menu = g_object_get_data (G_OBJECT (widget), "recent-menu");
+	if (event != NULL) {
+		button = event->button;
+		activate_time = event->time;
+	}
 	gtk_menu_popup (GTK_MENU (menu), NULL, NULL, menu_position_under_widget, widget,
-			event->button, event->time);
+			button, activate_time);
  
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
         return TRUE;

>Release-Note:
>Audit-Trail:
>Unformatted: