patches for gtkfilesel.c and gtkmain.c




 Ok I went a trawled through gtkfilesel.c to try and fix the bugs that
I had found yesterday. I'll try and explain the problems I found at
the top of each patch file.
 Also the only way I could get debugging to work, even on my linux
box, was to stop linking against gtk and include all the .o's from the
gtk dir. The static lib. doesn't seem to work at all ?

 1) cmpl_state->directory_storage was set to a free'd struct when all
the items in the list did not pass the test 

if (cdl->data == cmpl_state->reference_dir)

2) length - [34] took the last '/' off and so under some conditions
correct_parent would fail the assert strchr(fullname, '/')

3) The last_slash stuff in correct_parent seems really weird I'm not
sure why it was there at all. But originally sometimes it would not
recognize valid dirs.

--- gtkfilesel-orig.c	Thu Oct  9 09:10:38 1997
+++ gtkfilesel.c	Thu Oct  9 11:59:40 1997
@@ -1075,6 +1075,7 @@
     cdsl->next = NULL;
   }
 
+  cmpl_state->directory_storage = NULL;
   while (cdl) {
     if (cdl->data == cmpl_state->reference_dir)
       cmpl_state->directory_storage = g_list_prepend(NULL, cdl->data);
@@ -1472,7 +1473,7 @@
 	  return FALSE;
 	}
 
-      cmpl_dir->fullname[length - 3] = 0;
+      cmpl_dir->fullname[length - 2] = 0;
 
       if(!correct_parent(cmpl_dir, &sbuf))
 	return FALSE;
@@ -1492,7 +1493,7 @@
 	  return FALSE;
 	}
 
-      cmpl_dir->fullname[length - 4] = 0;
+      cmpl_dir->fullname[length - 3] = 0;
 
       if(!correct_parent(cmpl_dir, &sbuf))
 	return FALSE;
@@ -1516,7 +1517,7 @@
   g_assert(last_slash);
 
   if(last_slash != cmpl_dir->fullname)
-    last_slash[0] = 0;
+    { /* last_slash[0] = 0; */ }
   else
     {
       c = last_slash[1];
@@ -1535,8 +1536,8 @@
 
   if(c)
     last_slash[1] = c;
-  else
-    last_slash[0] = '/';
+  /* else
+    last_slash[0] = '/'; */
 
   /* it was a link, have to figure it out the hard way */
 


1) This problem was hilighted as the comment says, goto the root dir
in the file selection dialog and hold the TAB key and the warnings
were generated from gtk_widget_event. This probably applies to other
things as well though, and maybe there should be more than just
GDK_MAP before it.

--- gtkmain-orig.c	Thu Oct  9 12:51:05 1997
+++ gtkmain.c	Thu Oct  9 12:52:25 1997
@@ -334,10 +334,17 @@
 	    }
 	  /* otherwise fall through */
 
+	case GDK_MAP:
+	  if (event_widget == NULL)
+	    {
+              break; /* this is happening in the fileselection box if you
+                        goto the root dir and hold tab down */
+            }
+	  /* otherwise fall through */
+
 	case GDK_EXPOSE:
 	case GDK_FOCUS_CHANGE:
 	case GDK_CONFIGURE:
-	case GDK_MAP:
 	case GDK_UNMAP:
 	case GDK_SELECTION_CLEAR:
 	case GDK_SELECTION_REQUEST:



-- 
/* James Antill ** http://www.and.org/ */ main(){int h[3][3]=
{{44680,57949,51424},{60552,41941,18576},{44782,57757,12000}};
int i=-1,j;while(i++<2){j^=j;while(j<3){int k=16;while(--k>=0)
putchar(h[i][j]&(1<<k)?'x':' ');++j;}putchar('\n');}exit(0);}



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