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

gEDA-cvs: CVS update: g_keys.c



  User: pcjc2   
  Date: 07/04/21 16:33:54

  Modified:    .        g_keys.c x_print.c
  Log:
  Check return value of gdk_keyval_name() is non NULL before
  
  attempting to match against it. Fixes bug #1692634.
  
  
  
  
  Revision  Changes    Path
  1.7       +8 -8      eda/geda/gaf/gschem/src/g_keys.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: g_keys.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_keys.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- g_keys.c	24 Feb 2007 11:47:33 -0000	1.6
  +++ g_keys.c	21 Apr 2007 20:33:54 -0000	1.7
  @@ -50,22 +50,22 @@
   {
     char *guile_string = NULL;
     char *modifier = NULL;
  +  char *key_name = NULL;
     SCM scm_retval;
   
     if (keyval == 0) {
       return 0;
     }
   
  -  /* don't pass the raw modifier key presses to the guile code */
  -  if (strstr(gdk_keyval_name(keyval), "Alt")) {
  +  key_name = gdk_keyval_name(keyval);
  +  if ( key_name == NULL ) {
       return 0;
     }
   
  -  if (strstr(gdk_keyval_name(keyval), "Shift")) {
  -    return 0;
  -  }
  -
  -  if (strstr(gdk_keyval_name(keyval), "Control")) {
  +  /* don't pass the raw modifier key presses to the guile code */
  +  if (strstr(key_name, "Alt")    ||
  +      strstr(key_name, "Shift")  ||
  +      strstr(key_name, "Control") ) {
       return 0;
     }
   
  @@ -80,7 +80,7 @@
     }
   
     guile_string = g_strdup_printf("(press-key %s%s\")",
  -				 modifier, gdk_keyval_name (keyval));
  +                                 modifier, key_name);
   
   #if DEBUG 
     printf("_%s_\n", guile_string);
  
  
  
  1.35      +18 -14    eda/geda/gaf/gschem/src/x_print.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_print.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_print.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -b -r1.34 -r1.35
  --- x_print.c	21 Apr 2007 18:59:07 -0000	1.34
  +++ x_print.c	21 Apr 2007 20:33:54 -0000	1.35
  @@ -130,24 +130,28 @@
   print_dialog_action_keypress (GtkWidget * widget, GdkEventKey * event,
                                 PrintDialog * dialog)
   {
  +  char *key_name;
  +
  +  key_name = gdk_keyval_name (event->keyval);
  +  if ( key_name == NULL ) return FALSE;
  +
     if (widget == GTK_WIDGET (dialog))
       {
  -      
  -      if (strcmp (gdk_keyval_name (event->keyval), "Escape") == 0)
  +      if (strcmp (key_name, "Escape") == 0)
   	{
   	  gtk_dialog_response (GTK_DIALOG (dialog),
   			       GTK_RESPONSE_REJECT);
   	  return TRUE;
   	}
  -      if (strcmp (gdk_keyval_name (event->keyval), "Return") == 0)
  +      if (strcmp (key_name, "Return") == 0)
   	{
   	  gtk_dialog_response (GTK_DIALOG (dialog),
   			       GTK_RESPONSE_ACCEPT);
   	  return TRUE;
   	}
       }
  -  return FALSE;
     
  +  return FALSE;
   }
   
   /*!
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs