rpms/xscreensaver/devel xscreensaver-5.00-fix-hacks.patch, NONE, 1.1 xscreensaver-5.00-kill-getimage.patch, NONE, 1.1 xscreensaver.spec, 1.17, 1.18 xscreensaver-5.00-hacks-segv-sigfpv.patch, 1.1, NONE xscreensaver-5.00-interag-segv.patch, 1.1, NONE xscreensaver-5.00-noseguy-cpueat.patch, 1.1, NONE

Mamoru Tasaka (mtasaka) fedora-extras-commits at redhat.com
Sun Jul 2 17:50:57 UTC 2006


Author: mtasaka

Update of /cvs/extras/rpms/xscreensaver/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6559

Modified Files:
	xscreensaver.spec 
Added Files:
	xscreensaver-5.00-fix-hacks.patch 
	xscreensaver-5.00-kill-getimage.patch 
Removed Files:
	xscreensaver-5.00-hacks-segv-sigfpv.patch 
	xscreensaver-5.00-interag-segv.patch 
	xscreensaver-5.00-noseguy-cpueat.patch 
Log Message:
* Sun Jul  1 2006 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1:5.00-12
- Fix other (extras, gl-extras) hacks (total: 21 hacks).
- Make sure the subprocess xscreensaver-getimage is properly
  killed by parent hack process.


xscreensaver-5.00-fix-hacks.patch:

--- NEW FILE xscreensaver-5.00-fix-hacks.patch ---
--- xscreensaver-5.00/hacks/attraction.c.attraction	2006-05-24 04:24:22.000000000 +0900
+++ xscreensaver-5.00/hacks/attraction.c	2006-06-29 06:33:57.000000000 +0900
@@ -729,12 +729,17 @@
 	  if(st->cbounce_p)  /* with correct bouncing */
 	    {
               /* so long as it's out of range, keep bouncing */
+	      /* limit the maximum number to bounce to 4.*/
+	      int bounce_allowed = 4;
 	
-              while( (st->balls[i].x >= (st->xlim - st->balls[i].size)) ||
+              while( bounce_allowed && (
+		     (st->balls[i].x >= (st->xlim - st->balls[i].size)) ||
                      (st->balls[i].y >= (st->ylim - st->balls[i].size)) ||
                      (st->balls[i].x <= 0) ||
                      (st->balls[i].y <= 0) )
+		     )
                 {
+                  bounce_allowed--;
                   if (st->balls[i].x >= (st->xlim - st->balls[i].size))
                     {
                       st->balls[i].x = (2*(st->xlim - st->balls[i].size) - st->balls[i].x);
--- xscreensaver-5.00/hacks/bumps.c.bumps	2006-03-27 14:30:45.000000000 +0900
+++ xscreensaver-5.00/hacks/bumps.c	2006-07-02 15:36:40.000000000 +0900
@@ -346,7 +346,7 @@
 	while( nSoften-- )
 		softenMultiplier *= 1.0f + ( 1.0f / 3.0f );	/* Softening takes the max height down, so scale up to compensate. */
 	maxHeight = pBumps->SpotLight.nLightRadius * softenMultiplier;
-	nAverager = ( 3 * 0xFFFF ) / maxHeight;
+	nAverager = maxHeight ? ( 3 * 0xFFFF ) / maxHeight : 0;
 
 	pBump = pBumps->aBumpMap;
 	if( bInvert )	/* Funny, it's actually the 'else' that inverts the bump map... */
@@ -361,7 +361,7 @@
 
 			pColor = pBumps->xColors;
 			for( iWidth=pBumps->iWinWidth; iWidth; --iWidth, ++pColor, ++pBump )
-				*pBump = ( ( pColor->red + pColor->green + pColor->blue ) / nAverager );
+			  *pBump = ( nAverager ? ( pColor->red + pColor->green + pColor->blue ) / nAverager : 0 );
 		}
 	}
 	else
@@ -376,7 +376,7 @@
 	
 			pColor = pBumps->xColors;
 			for( iWidth=pBumps->iWinWidth; iWidth; --iWidth, ++pColor, ++pBump )
-				*pBump = ( maxHeight - ( ( pColor->red + pColor->green + pColor->blue ) / nAverager ) );
+			  *pBump = ( maxHeight - ( nAverager ? ( pColor->red + pColor->green + pColor->blue ) / nAverager : 0 ) );
 		}
 	}
 
--- xscreensaver-5.00/hacks/glx/carousel.c.carousel	2006-04-06 11:30:00.000000000 +0900
+++ xscreensaver-5.00/hacks/glx/carousel.c	2006-07-02 16:13:44.000000000 +0900
@@ -217,12 +217,18 @@
 
   if (wire)
     image_loaded_cb (0, 0, 0, 0, 0, 0, frame);
-  else
+  else{
+    int w, h;
+    w = (MI_WIDTH(mi)  / 2) - 1;
+    h = (MI_HEIGHT(mi) / 2) - 1;
+    if (w <= 0) w = 1;
+    if (h <= 0) h = 1;
     load_texture_async (mi->xgwa.screen, mi->window, *ss->glx_context,
-                        (MI_WIDTH(mi)  / 2) - 1,
-                        (MI_HEIGHT(mi) / 2) - 1,
+                        w,
+                        h,
                         mipmap_p, frame->loading.texid, 
                         image_loaded_cb, frame);
+  }
 }
 
 
--- xscreensaver-5.00/hacks/coral.c.coral	2006-03-17 08:28:00.000000000 +0900
+++ xscreensaver-5.00/hacks/coral.c	2006-06-29 15:45:58.000000000 +0900
@@ -100,12 +100,15 @@
     st->colorsloth = st->nwalkers*2/st->ncolors;
     XSetForeground(st->dpy, st->draw_gc, st->colors[st->colorindex].pixel);
 
+    if ((st->width <= 2) || (st->height <= 2)) return;
+
     for( i = 0; i < seeds; i++ ) {
         int x, y;
+	int max_repeat = 10;
         do {
           x = 1 + random() % (st->width - 2);
           y = 1 + random() % (st->height - 2);
-        } while( getdot(x, y) );
+        } while( getdot(x, y) && max_repeat--);
 
         setdot((x-1), (y-1)); setdot(x, (y-1)); setdot((x+1), (y-1));
 	setdot((x-1),  y   ); setdot(x,  y   ); setdot((x+1),  y   );
@@ -169,7 +172,8 @@
       st->nwalkers--;
       st->walkers[i].x = st->walkers[st->nwalkers].x;
       st->walkers[i].y = st->walkers[st->nwalkers].y;
-      if( 0 == (st->nwalkers%st->colorsloth) ) {
+      if( 0 == 
+	  ((st->colorsloth ? st->nwalkers%st->colorsloth : 0)) ) {
         color = True;
       }
 		  
--- xscreensaver-5.00/hacks/critical.c.critical	2006-03-22 12:41:54.000000000 +0900
+++ xscreensaver-5.00/hacks/critical.c	2006-06-29 15:22:12.000000000 +0900
@@ -289,7 +289,8 @@
      screens. */
   model_w = 80;
   st->settings.cell_size = st->wattr.width / model_w;
-  model_h = st->wattr.height / st->settings.cell_size;
+  model_h = st->settings.cell_size ?
+    st->wattr.height / st->settings.cell_size : 0;
 
   /* Construct the initial model state. */
 
--- xscreensaver-5.00/hacks/crystal.c.crystal	2006-05-24 04:28:54.000000000 +0900
+++ xscreensaver-5.00/hacks/crystal.c	2006-06-29 16:05:41.000000000 +0900
@@ -92,6 +92,9 @@
 #define DEF_MAXSIZE "False"
 #define DEF_CYCLE "True"
 
+#undef NRAND
+#define NRAND(n)           ( (n) ? (int) (LRAND() % (n)) : 0)
+
 #define min(a,b) ((a) <= (b) ? (a) : (b))
 
 static int  nx, ny;
@@ -980,9 +983,12 @@
 			cryst->offset_w = (int) (cryst->b * 0.5);
 		}
 	} else {
+		int max_repeat = 10;
 		cryst->offset_w = -1;
-		while (cryst->offset_w < 4 || (int) (cryst->offset_w - cryst->b *
-				    sin((cryst->gamma - 90) * PI_RAD)) < 4) {
+		while (max_repeat-- && 
+		  (cryst->offset_w < 4 || (int) (cryst->offset_w - cryst->b *
+				    sin((cryst->gamma - 90) * PI_RAD)) < 4)
+			   ) {
 			cryst->b = NRAND((int) (cryst->win_height / (cos((cryst->gamma - 90) *
 					    PI_RAD))) - cell_min) + cell_min;
 			if (cryst->planegroup > 8)
--- xscreensaver-5.00/hacks/decayscreen.c.decay	2006-03-31 19:27:40.000000000 +0900
+++ xscreensaver-5.00/hacks/decayscreen.c	2006-07-02 15:31:41.000000000 +0900
@@ -186,7 +186,7 @@
      default: abort();
     }
 
-#define nrnd(x) (random() % (x))
+#define nrnd(x) ((x) ? random() % (x) : x)
 
     if (st->mode == MELT || st->mode == STRETCH) {
       left = nrnd(st->sizex/2);
--- xscreensaver-5.00/hacks/eruption.c.eruption	2006-03-17 08:22:43.000000000 +0900
+++ xscreensaver-5.00/hacks/eruption.c	2006-06-29 15:19:52.000000000 +0900
@@ -116,6 +116,7 @@
 	  else if (st->particles[i].xpos >= st->iWinWidth - 2)
 	    {
 	      st->particles[i].xpos = st->iWinWidth - 2;
+	      if (st->particles[i].xpos < 1) st->particles[i].xpos = 1;
 	      st->particles[i].xdir = -st->particles[i].xdir + 4;
 	      st->particles[i].colorindex = st->iColorCount;
 	    }
@@ -129,9 +130,11 @@
 	  else if (st->particles[i].ypos >= st->iWinHeight - 3)
 	    {
 	      st->particles[i].ypos = st->iWinHeight- 3;
+	      if (st->particles[i].ypos < 1) st->particles[i].ypos = 1;
 	      st->particles[i].ydir = (-st->particles[i].ydir >> 2) - (random() % 2);
 	      st->particles[i].colorindex = st->iColorCount;
 	    }
+
 	  
 	  /* st->gravity kicks in */
 	  st->particles[i].ydir += st->gravity;
@@ -140,6 +143,7 @@
 	  st->particles[i].colorindex--;
 	  
 	  /* draw particle */
+	  if (st->iWinHeight <= 2 || st->iWinWidth <= 2) continue;
 	  st->fire[st->particles[i].ypos][st->particles[i].xpos] = st->particles[i].colorindex;
 	  st->fire[st->particles[i].ypos][st->particles[i].xpos - 1] = st->particles[i].colorindex;
 	  st->fire[st->particles[i].ypos + 1][st->particles[i].xpos] = st->particles[i].colorindex;
--- xscreensaver-5.00/hacks/fireworkx.c.fireworkx	2006-03-17 08:22:43.000000000 +0900
+++ xscreensaver-5.00/hacks/fireworkx.c	2006-06-29 14:51:34.000000000 +0900
@@ -42,7 +42,7 @@
 void mmx_glow(char *a, int b, int c, int d, char *e);
 #endif
 
-#define rnd(x) ((int)(random() % (x)))
+#define rnd(x) ((x) ? (int)(random() % (x)) : 0)
 
 typedef struct {
   unsigned int burn;
@@ -161,6 +161,7 @@
   unsigned int w = st->width;
   unsigned int h = st->height;
   unsigned char *pa, *pb, *pm, *po;
+  if (!st->xim) return;
   pm = st->palaka1;
   po = st->palaka2;
   for(n=0;n<w*4;n++) 
@@ -168,7 +169,7 @@
   pm+=n; po+=n; h-=2; 
   pa = pm-(w*4);
   pb = pm+(w*4);
-  for(n=4;n<w*h*4-4;n++){
+  for(n=4;(signed) n< (signed) (w*h*4-4); n++){
   q    = pm[n-4] + (pm[n]*8) + pm[n+4] + 
          pa[n-4] + pa[n] + pa[n+4] + 
          pb[n-4] + pb[n] + pb[n+4];
@@ -272,6 +273,7 @@
   st->palaka2 = NULL;
   st->xim = XCreateImage(st->dpy, xwa.visual, xwa.depth, ZPixmap, 0, 0,
 		     st->width, st->height, 8, 0);
+  if (!st->xim) return;
   st->palaka1 = (unsigned char *) calloc(st->xim->height+1,st->xim->width*4) + 8;
   if(st->flash_on|st->glow_on)
   st->palaka2 = (unsigned char *) calloc(st->xim->height+1,st->xim->width*4) + 8;
@@ -286,6 +288,7 @@
 {
   int x,y,i,j;
   unsigned char r, g, b;
+  if (!st->xim) return;
   i = 0;
   j = 0;
   if (st->depth==16) {
--- xscreensaver-5.00/hacks/goop.c.goop	2006-04-06 11:30:04.000000000 +0900
+++ xscreensaver-5.00/hacks/goop.c	2006-06-29 07:39:02.000000000 +0900
@@ -258,9 +258,11 @@
 
   blob_max = (width < height ? width : height) / 2;
   blob_min = (blob_max * 2) / 3;
-  for (i = 0; i < layer->nblobs; i++)
+  for (i = 0; i < layer->nblobs; i++){
+    int j = blob_max - blob_min;
     layer->blobs[i] = make_blob (dpy, width, height,
-				 (random() % (blob_max-blob_min)) + blob_min);
+				 (j ? random() % j : 0) + blob_min);
+  }
 
   layer->pixmap = XCreatePixmap (dpy, window, width, height, 1);
   layer->gc = XCreateGC (dpy, layer->pixmap, 0, &gcv);
--- xscreensaver-5.00/hacks/interaggregate.c.interg	2006-04-06 11:30:04.000000000 +0900
+++ xscreensaver-5.00/hacks/interaggregate.c	2006-07-01 02:22:11.000000000 +0900
@@ -352,11 +352,11 @@
 {
     unsigned long c;
 
-    if ( x >= f->width ) x -= f->width;
-    else if ( x < 0 ) x += f->width;
+    while ( x >= f->width ) x -= f->width;
+    while ( x < 0 ) x += f->width;
 	
-    if ( y >= f->height ) y -= f->height;
-    else if ( y < 0 ) y += f->height;
+    while ( y >= f->height ) y -= f->height;
+    while ( y < 0 ) y += f->height;
 
     /* if ( in_bounds(f, x, y) ) ... */
 
@@ -566,7 +566,7 @@
 	{
 	    if (i < base_orbits )
 	    {
-		if ( f->base_on_center )
+	        if ( f->base_on_center )
 		    circle->center = &f->center_of_universe; 
 		else
 		{
@@ -719,7 +719,9 @@
 		double d, dsqr, dx, dy;
 		Circle *c2 = f->circles + j;
 
+#ifdef TIME_ME
 		++f->possible_intersections;
+#endif
 		dx = c2->x - c1->x;
 		dy = c2->y - c1->y;
 
@@ -745,7 +747,9 @@
 		     * intersection 
 		     */
 
+#ifdef TIME_ME
 		    ++f->intersection_count;
+#endif
 
 		    /* unit vector in direction of c1 to c2 */
 		    bx = dx / d;
--- xscreensaver-5.00/hacks/jigsaw.c.jigsaw	2006-03-27 14:30:45.000000000 +0900
+++ xscreensaver-5.00/hacks/jigsaw.c	2006-07-02 16:00:08.000000000 +0900
@@ -225,7 +225,7 @@
                          int *x_ret, int *y_ret,
                          Pixmap *mask_ret, Pixmap *outline_ret)
 {
-  int w = size * 3;
+  int w = (size ? size * 3 : 2);
   int h = w;
   int x = size;
   int y = size;
@@ -404,8 +404,8 @@
   make_puzzle_pixmaps (st);
 
   cmap = xgwa.colormap;
-  st->width  = xgwa.width  / st->piece_width;
-  st->height = xgwa.height / st->piece_height;
+  st->width  = (st->piece_width ? xgwa.width  / st->piece_width : 0);
+  st->height = (st->piece_height ? xgwa.height / st->piece_height : 0);
   st->x_border = (xgwa.width  - (st->width  * st->piece_width)) / 2;
   st->y_border = (xgwa.height - (st->height * st->piece_width)) / 2;
 
--- xscreensaver-5.00/hacks/kaleidescope.c.kalei	2006-03-13 11:13:07.000000000 +0900
+++ xscreensaver-5.00/hacks/kaleidescope.c	2006-06-29 07:42:42.000000000 +0900
@@ -228,10 +228,10 @@
 {
 
   /* Give the segment some random values */
-  ((Ksegment *)obj->cur)->x1 = random() % g->xoff;
-  ((Ksegment *)obj->cur)->y1 = random() % g->yoff;
-  ((Ksegment *)obj->cur)->x2 = random() % g->xoff;
-  ((Ksegment *)obj->cur)->y2 = random() % g->yoff;
+  ((Ksegment *)obj->cur)->x1 = (g->xoff ? random() % g->xoff : 0);
+  ((Ksegment *)obj->cur)->y1 = (g->yoff ? random() % g->yoff : 0);
+  ((Ksegment *)obj->cur)->x2 = (g->xoff ? random() % g->xoff : 0);
+  ((Ksegment *)obj->cur)->y2 = (g->yoff ? random() % g->yoff : 0);
 }
 
 
--- xscreensaver-5.00/hacks/noseguy.c.cpueat	2006-03-17 08:13:56.000000000 +0900
+++ xscreensaver-5.00/hacks/noseguy.c	2006-06-28 00:48:11.000000000 +0900
@@ -196,6 +196,17 @@
 		st->move_length = st->Width / 100 + random() % 90, tries = 8;
 	    else
 		tries--;
+	    /* There maybe the case that we won't be able to exit from
+	       this routine (especially when the geometry is too small)!!
+
+	       Ensure that we can exit from this routine.
+	     */
+#if 1
+	    if (!tries && (st->move_length <= 1)) {
+	      st->move_length = 1;
+	      break;
+	    }
+#endif
 	    switch (random() % 8)
 	    {
 	    case 0:
@@ -239,7 +250,8 @@
 	    }
 	} while (!st->move_dir);
     }
-    walk(st, st->move_dir);
+    if (st->move_dir)
+      walk(st, st->move_dir);
     --st->move_length;
     st->next_fn = move;
 }
--- xscreensaver-5.00/hacks/petri.c.petri	2006-02-26 05:13:25.000000000 +0900
+++ xscreensaver-5.00/hacks/petri.c	2006-06-29 07:30:28.000000000 +0900
@@ -121,8 +121,8 @@
 };
 
 
-#define cell_x(c) (((c) - st->arr) % st->arr_width)
-#define cell_y(c) (((c) - st->arr) / st->arr_width)
+#define cell_x(c) (st->arr_width ? ((c) - st->arr) % st->arr_width : 0)
+#define cell_y(c) (st->arr_width ? ((c) - st->arr) / st->arr_width : 0)
 
 
 static int random_life_value (struct state *st)
@@ -437,8 +437,8 @@
           }
       }
 
-    st->xSize = st->windowWidth / st->arr_width;
-    st->ySize = st->windowHeight / st->arr_height;
+    st->xSize = st->arr_width ? st->windowWidth / st->arr_width : 0;
+    st->ySize = st->arr_height ? st->windowHeight / st->arr_height : 0;
     if (st->xSize > st->ySize)
     {
 	st->xSize = st->ySize;
@@ -586,8 +586,8 @@
     
     while (n--) 
     {
-	int x = random () % st->arr_width;
-	int y = random () % st->arr_height;
+      int x = st->arr_width ? random () % st->arr_width : 0;
+      int y = st->arr_height ? random () % st->arr_height : 0;
 	int c;
 	FLOAT s;
 	if (b)
@@ -597,7 +597,7 @@
 	}
 	else
 	{
-	    c = (random () % (st->count-1)) + 1;
+	  c = ((st->count - 1) ? random () % (st->count-1) : 0) + 1;
 	    s = RAND_FLOAT * (st->maxlifespeed - st->minlifespeed) + st->minlifespeed;
 	}
 	newcell (st, &st->arr[y * st->arr_width + x], c, s);
--- xscreensaver-5.00/hacks/piecewise.c.piecewise	2006-03-08 18:57:55.000000000 +0900
+++ xscreensaver-5.00/hacks/piecewise.c	2006-06-29 07:14:50.000000000 +0900
@@ -358,7 +358,7 @@
   dr = floor(maxradius * h) - r0 + 1;
 
   for (i=0;i<n;i++) {
-    c[i].r = r0 + random() % dr;
+    c[i].r = r0 + ((dr > 0) ? random() % dr : 0);
     c[i].x = c[i].r + frand(w - 1 - 2 * c[i].r);
     c[i].y = c[i].r + frand(h - 1 - 2 * c[i].r);
     c[i].visible = random() & 1;
--- xscreensaver-5.00/hacks/popsquares.c.popsquares	2006-03-08 18:58:35.000000000 +0900
+++ xscreensaver-5.00/hacks/popsquares.c	2006-06-29 07:02:13.000000000 +0900
@@ -83,8 +83,8 @@
 
   st->sw = st->xgwa.width / st->subdivision;
   st->sh = st->xgwa.height / st->subdivision;
-  st->gw = st->xgwa.width / st->sw;
-  st->gh = st->xgwa.height / st->sh;
+  st->gw = st->sw ? st->xgwa.width / st->sw : 0;
+  st->gh = st->sh ? st->xgwa.height / st->sh : 0;
   st->nsquares = st->gw * st->gh;
 
   gcv.foreground = fg.pixel;
--- xscreensaver-5.00/hacks/ripples.c.ripples	2006-03-27 14:30:45.000000000 +0900
+++ xscreensaver-5.00/hacks/ripples.c	2006-06-29 06:59:39.000000000 +0900
@@ -757,10 +757,13 @@
   case ripple_blob: {
     double power;
 
+    int tmp_i, tmp_j;
     power = drop_dist[random() % (sizeof(drop_dist)/sizeof(drop_dist[0]))]; /* clumsy */
     dheight = (int)(drop * (power + 0.01));
-    newx = radius + border + (random() % (int)(st->width - 2*border - 2*radius*power));
-    newy = radius + border + (random() % (int)(st->height - 2*border - 2*radius*power));
+    tmp_i = (int)(st->width - 2*border - 2*radius*power);
+    tmp_j = (int)(st->height - 2*border - 2*radius*power);
+    newx = radius + border + ((tmp_i > 0) ? random() % tmp_i : 0);
+    newy = radius + border + ((tmp_j > 0) ? random() % tmp_j : 0);
     add_circle_drop(st, newx, newy, radius, dheight);
   }
   break;
@@ -770,12 +773,15 @@
     int x;
     int cx, cy;
     short *buf = (random()&1) ? st->bufferA : st->bufferB;
+    int tmp_i, tmp_j;
 
     radius = (1 + (random() % 5)) * (1 + (random() % 5));
     dheight = drop / 128;
     if (random() & 1) dheight = -dheight;
-    newx = radius + border + (random() % (st->width - 2*border - 2*radius));
-    newy = radius + border + (random() % (st->height - 2*border - 2*radius));
+    tmp_i = st->width - 2*border - 2*radius;
+    tmp_j = st->height - 2*border - 2*radius;
+    newx = radius + border + ((tmp_i > 0) ? random() % tmp_i : 0);
+    newy = radius + border + ((tmp_j > 0) ? random() % tmp_j : 0);
     x = newy * st->width + newx;
     for (cy = -radius; cy <= radius; cy++)
       for (cx = -radius; cx <= radius; cx++)
--- xscreensaver-5.00/hacks/rotzoomer.c.rotzoomer	2006-04-01 10:53:13.000000000 +0900
+++ xscreensaver-5.00/hacks/rotzoomer.c	2006-07-02 13:07:38.000000000 +0900
@@ -176,8 +176,8 @@
     za->ww = st->width - za->w;
     za->hh = st->height - za->h;
 
-    za->x = (random() % za->ww);
-    za->y = (random() % za->hh);
+    za->x = (za->ww ? random() % za->ww : 0);
+    za->y = (za->hh ? random() % za->hh : 0);
 
     za->dx = ((2 * (random() & 1)) - 1) * (100 + random() % 300);
     za->dy = ((2 * (random() & 1)) - 1) * (100 + random() % 300);
@@ -269,8 +269,9 @@
     st->zoom_box[i] = create_zoom (st);
   }
 
-  memcpy (st->buffer_map->data, st->orig_map->data,
-          st->height * st->buffer_map->bytes_per_line);
+  if (st->height && st->orig_map->data)
+    memcpy (st->buffer_map->data, st->orig_map->data,
+	    st->height * st->buffer_map->bytes_per_line);
 
   DisplayImage(st, 0, 0, st->width, st->height);
 }
--- xscreensaver-5.00/hacks/slidescreen.c.slidescreen	2006-03-27 14:30:41.000000000 +0900
+++ xscreensaver-5.00/hacks/slidescreen.c	2006-07-02 15:41:08.000000000 +0900
@@ -326,7 +326,8 @@
      /* alternate between horizontal and vertical slides */
      /* note that draw_dir specifies the direction the _hole_ moves, not the tiles */
      if (st->draw_last == VERTICAL) {
-       if ((st->draw_rnd = random () % (st->grid_w - 1)) < st->hole_x) {
+       if (((st->grid_w > 1) ? st->draw_rnd = random () % (st->grid_w - 1) : 0)
+	   < st->hole_x) {
          st->draw_dx = -1; st->draw_dir = LEFT;  st->hole_x -= st->draw_rnd;
        } else {
          st->draw_dx =  1; st->draw_dir = RIGHT; st->draw_rnd -= st->hole_x;
@@ -334,7 +335,8 @@
        st->draw_dy = 0; st->draw_w = st->draw_size = st->draw_rnd + 1; st->draw_h = 1;
        st->draw_last = HORIZONTAL;
      } else {
-       if ((st->draw_rnd = random () % (st->grid_h - 1)) < st->hole_y) {
+       if (((st->grid_h > 1) ? st->draw_rnd = random () % (st->grid_h - 1) : 0)
+	   < st->hole_y) {
          st->draw_dy = -1; st->draw_dir = UP;    st->hole_y -= st->draw_rnd;
        } else {
          st->draw_dy =  1; st->draw_dir = DOWN;  st->draw_rnd -= st->hole_y;
--- xscreensaver-5.00/hacks/twang.c.twang	2006-03-27 14:30:37.000000000 +0900
+++ xscreensaver-5.00/hacks/twang.c	2006-07-02 15:24:03.000000000 +0900
@@ -554,8 +554,8 @@
 	st->tileSize = st->windowHeight / 2;
     }
 
-    st->columns = st->windowWidth / st->tileSize;
-    st->rows = st->windowHeight / st->tileSize;
+    st->columns = st->tileSize ? st->windowWidth / st->tileSize : 0;
+    st->rows = st->tileSize ? st->windowHeight / st->tileSize : 0;
 
     if ((st->maxColumns != 0) && (st->columns > st->maxColumns))
     {

xscreensaver-5.00-kill-getimage.patch:

--- NEW FILE xscreensaver-5.00-kill-getimage.patch ---
--- xscreensaver-5.00/hacks/screenhack.c.getimage	2006-07-02 16:23:17.000000000 +0900
+++ xscreensaver-5.00/hacks/screenhack.c	2006-07-03 02:30:43.000000000 +0900
@@ -109,6 +109,10 @@
 #if HAVE_SETLOCALE
 #include <locale.h>
 #endif
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/types.h>
+#include <sys/wait.h>		/* for waitpid() and associated macros */
+#endif
 
 #ifndef _XSCREENSAVER_VROOT_H_
 # error Error!  You have an old version of vroot.h!  Check -I args.
@@ -131,6 +135,8 @@
 const char *progclass;  /* used by ../utils/resources.c */
 Bool mono_p;		/* used by hacks */
 
+int pid_child = 0;      /* grobal integer to record the pid 
+			   of child process (used in grabclient.c) */
 
 static XrmOptionDescRec default_options [] = {
   { "-root",	".root",		XrmoptionNoArg, "True" },
@@ -645,6 +651,24 @@
   if (window2)
     ft->free_cb (dpy, window2, closure2);
 #endif
+
+  /* Finally kill the child process left alive.
+
+     Yes, This must be done properly by finalize_cb() in grabclient.c,
+     however, according to somewhat buggy behaviour of XtAppAddInput
+     (in fork_exec_cb in grabclient.c) (or somewhat other reason),
+     there is a case that finalize_cb() is not called.
+
+     In that case, xscreensaver-getimage process remains forever,
+     which actually eats CPU and memory too much!!
+   */
+
+  if (pid_child){
+    int status;
+    kill(pid_child, SIGTERM);
+    waitpid(pid_child, &status, 0);
+  }
+
 }
 
 
--- xscreensaver-5.00/utils/grabclient.c.getimage	2006-03-28 16:46:00.000000000 +0900
+++ xscreensaver-5.00/utils/grabclient.c	2006-07-03 02:29:54.000000000 +0900
@@ -38,6 +38,9 @@
 # include <sys/wait.h>		/* for waitpid() and associated macros */
 #endif
 
+extern int pid_child;           /* grobal integer to record the pid 
+				   of child process (used in grabclient.c)
+				*/
 
 extern char *progname;
 
@@ -389,7 +392,7 @@
     default:					/* parent */
       fclose (data->write_pipe);
       data->write_pipe = 0;
-      data->pid = forked;
+      data->pid = pid_child = forked;
       break;
     }
 }
@@ -421,7 +424,7 @@
     {
       int status;
       waitpid (data->pid, &status, 0);
-      data->pid = 0;
+      data->pid = pid_child = 0;
     }
 
   memset (data, 0, sizeof (*data));


Index: xscreensaver.spec
===================================================================
RCS file: /cvs/extras/rpms/xscreensaver/devel/xscreensaver.spec,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- xscreensaver.spec	30 Jun 2006 17:40:36 -0000	1.17
+++ xscreensaver.spec	2 Jul 2006 17:50:57 -0000	1.18
@@ -1,7 +1,7 @@
 %define	name 		xscreensaver
 
 %define version		5.00
-%define fedora_rel	11
+%define fedora_rel	12
 
 %define fedora_ver	5.90
 %define default_text 	%{_datadir}/doc/fedora-release-%{fedora_ver}/eula.txt
@@ -29,9 +29,8 @@
 Patch102:	xscreensaver-5.00-matherr-utils.patch
 Patch104:	xscreensaver-5.00-xmlmanfix.patch
 Patch105:	xscreensaver-5.00-text-locale.patch
-Patch106:	xscreensaver-5.00-noseguy-cpueat.patch
-Patch107:	xscreensaver-5.00-hacks-segv-sigfpv.patch
-Patch108:	xscreensaver-5.00-interag-segv.patch
+Patch110:	xscreensaver-5.00-fix-hacks.patch
+Patch111:	xscreensaver-5.00-kill-getimage.patch
 
 %package base
 Summary: 	A minimal installation of xscreensaver
@@ -104,9 +103,8 @@
 %patch102 -p1 -b .matherr2
 %patch104 -p1 -b .xmlfix
 %patch105 -p1 -b .text-locale
-%patch106 -p1 -b .noseguy-cpueat
-%patch107 -p1 -b .extras-segv-fpe
-%patch108 -p1 -b .interag-segv
+%patch110 -p1 -b .fix-hacks
+%patch111 -p1 -b .kill-getimage
 
 install -c -m644 -p %{SOURCE10} po/ja.po
 
@@ -290,6 +288,11 @@
 %defattr(-,root,root)
 
 %changelog
+* Sun Jul  1 2006 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1:5.00-12
+- Fix other (extras, gl-extras) hacks (total: 21 hacks).
+- Make sure the subprocess xscreensaver-getimage is properly
+  killed by parent hack process.
+
 * Fri Jun 30 2006 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1:5.00-11
 - Fix interaggregate segv.
 


--- xscreensaver-5.00-hacks-segv-sigfpv.patch DELETED ---


--- xscreensaver-5.00-interag-segv.patch DELETED ---


--- xscreensaver-5.00-noseguy-cpueat.patch DELETED ---




More information about the scm-commits mailing list