Gtk 1.0.1 - SEGV in selection handling



Looks like 1.0.1 has introduced an error in the selection handling
code.  Happens to me on Solaris, you can reproduce it by selecting some
text in an entry widget and typing over it.  The application crashes
with a SIGSEGV.

It seems a change was made in gtkselection.c around line 633 which
would cause this - in 1.0.0 tmp_list was compared with NULL before
going any further.  In 1.0.1, it isn't, and selection_info gets
dereferenced.  When it's NULL (since current_selections is NULL), the
application crashes.

This patch seems to fix it, but is the Right Thing To Do?

*** gtkselection.c.orig
--- gtkselection.c
***************
*** 630,636 ****
        tmp_list = tmp_list->next;
      }
      
!   if (selection_info->time > event->time)
      return FALSE;		/* return FALSE to indicate that
  				 * the selection was out of date,
  				 * and this clear should be ignored */
--- 630,636 ----
        tmp_list = tmp_list->next;
      }
      
!   if (tmp_list == NULL || selection_info->time > event->time)
      return FALSE;		/* return FALSE to indicate that
  				 * the selection was out of date,
  				 * and this clear should be ignored */
-- 
Des Herriott
des@ops.netcom.net.uk



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