*** arc.c.orig	Mon Sep 20 11:28:16 1999
--- arc.c	Mon Sep 20 11:28:16 1999
***************
*** 847,858 ****
     struct ArcRec *arc_ptr=obj_ptr->detail.a;
     XPoint *sv=NULL;
!    IntPoint *pv, *cntrlv=NULL;
!    int i, sn, cntrln, v_index, cur_index, angle;
!    int num_vs=0, angle90=(90<<6), angle360=(360<<6), seen_angle1;
     int cx=arc_ptr->xc, cy=arc_ptr->yc;
     double hw=(double)(arc_ptr->w>>1), hh=(double)(arc_ptr->h>>1);
     int start_angle=angle90-angle360, end_angle=angle360;
  
!    seen_angle1 = FALSE;
     if (angle1 > angle2) {
        angle = angle2;
--- 847,860 ----
     struct ArcRec *arc_ptr=obj_ptr->detail.a;
     XPoint *sv=NULL;
!    IntPoint *pv=NULL, *cntrlv=NULL;
!    int i=0, sn=0, cntrln=0, v_index=0, cur_index=0, angle=0;
!    int num_vs=0, angle90=(90<<6), angle360=(360<<6), seen_angle1=FALSE;
     int cx=arc_ptr->xc, cy=arc_ptr->yc;
     double hw=(double)(arc_ptr->w>>1), hh=(double)(arc_ptr->h>>1);
     int start_angle=angle90-angle360, end_angle=angle360;
+    IntPoint first_pt;
  
!    memset(&first_pt, 0, sizeof(IntPoint));
! 
     if (angle1 > angle2) {
        angle = angle2;
***************
*** 992,997 ****
              sin_val = cos((double)(angle1*M_PI/180.0/64.0));
              cos_val = sin((double)(angle1*M_PI/180.0/64.0));
!             pv[0].x = cx + round(hw*sin_val);
!             pv[0].y = cy - round(hh*cos_val);
              for (i=1; i < count; i++) {
                 pv[i].x = oval_vs[(v_index+7-(count-i)) % 24].x;
--- 994,999 ----
              sin_val = cos((double)(angle1*M_PI/180.0/64.0));
              cos_val = sin((double)(angle1*M_PI/180.0/64.0));
!             pv[0].x = first_pt.x = cx + round(hw*sin_val);
!             pv[0].y = first_pt.y = cy - round(hh*cos_val);
              for (i=1; i < count; i++) {
                 pv[i].x = oval_vs[(v_index+7-(count-i)) % 24].x;
***************
*** 1033,1036 ****
--- 1035,1044 ----
        int x, y;
  
+       if (i == 0) {
+          TransformPointThroughCTM(first_pt.x-obj_ptr->x, first_pt.y-obj_ptr->y,
+                obj_ptr->ctm, &x, &y);
+          first_pt.x = x + obj_ptr->x;
+          first_pt.y = y + obj_ptr->y;
+       }
        TransformPointThroughCTM(pv[i].x-obj_ptr->x, pv[i].y-obj_ptr->y,
              obj_ptr->ctm, &x, &y);
***************
*** 1040,1045 ****
        (*rotated_vlist)[i].y = (short)OFFSET_Y(pv[i].y);
     }
!    sv = MakeIntSplinePolyVertex(&sn, &cntrln, &cntrlv,
!          drawOrigX, drawOrigY, num_vs, pv);
     if (sv == NULL) {
        FailAllocMessage();
--- 1048,1064 ----
        (*rotated_vlist)[i].y = (short)OFFSET_Y(pv[i].y);
     }
!    if (num_vs == 1) {
!       /* well, the real way to do this is to use a mid-point */
!       sn = 2;
!       sv = (XPoint*)malloc((num_vs+1)*sizeof(XPoint));
!       if (sv == NULL) FailAllocMessage();
!       sv[0].x = (short)(OFFSET_X(first_pt.x));
!       sv[0].y = (short)(OFFSET_Y(first_pt.y));
!       sv[1].x = (short)(OFFSET_X(pv[0].x));
!       sv[1].y = (short)(OFFSET_Y(pv[0].y));
!    } else {
!       sv = MakeIntSplinePolyVertex(&sn, &cntrln, &cntrlv,
!             drawOrigX, drawOrigY, num_vs, pv);
!    }
     if (sv == NULL) {
        FailAllocMessage();
*** rect.c.orig	Mon Sep 20 11:28:17 1999
--- rect.c	Mon Sep 20 11:28:17 1999
***************
*** 727,731 ****
           return (!PointInBBox(XOff, YOff, bbox));
        }
!    } else {
        if (!(fill == NONEPAT || (fill == BACKPAT && trans_pat))) {
           if (PointInPolygon(XOff, YOff, rcbox_ptr->rotated_n,
--- 727,731 ----
           return (!PointInBBox(XOff, YOff, bbox));
        }
!    } else if (rcbox_ptr->rotated_vlist != NULL) {
        if (!(fill == NONEPAT || (fill == BACKPAT && trans_pat))) {
           if (PointInPolygon(XOff, YOff, rcbox_ptr->rotated_n,
***************
*** 737,740 ****
--- 737,741 ----
              rcbox_ptr->rotated_vlist, ZOOMED_HALF_W(rcbox_ptr->width));
     }
+    return FALSE;
  }
  
***************
*** 791,795 ****
           return ((fabs((double)(XOff-x1))<=w) || (fabs((double)(XOff-x2))<=w));
        }
!    } else {
        if (!(fill == NONEPAT || (fill == BACKPAT && trans_pat))) {
           if (PointInPolygon(XOff, YOff, oval_ptr->rotated_n,
--- 792,796 ----
           return ((fabs((double)(XOff-x1))<=w) || (fabs((double)(XOff-x2))<=w));
        }
!    } else if (oval_ptr->rotated_vlist != NULL) {
        if (!(fill == NONEPAT || (fill == BACKPAT && trans_pat))) {
           if (PointInPolygon(XOff, YOff, oval_ptr->rotated_n,
***************
*** 801,804 ****
--- 802,806 ----
              oval_ptr->rotated_vlist, ZOOMED_HALF_W(oval_ptr->width));
     }
+    return FALSE;
  }
  
***************
*** 823,827 ****
           sv[sn].x = sv[0].x; sv[sn].y = sv[0].y;
           if (PointInPolygon(XOff, YOff, sn+1, sv)) return TRUE;
!       } else {
           sn = poly_ptr->rotated_n;
           sv = poly_ptr->rotated_vlist;
--- 825,829 ----
           sv[sn].x = sv[0].x; sv[sn].y = sv[0].y;
           if (PointInPolygon(XOff, YOff, sn+1, sv)) return TRUE;
!       } else if (poly_ptr->rotated_vlist != NULL) {
           sn = poly_ptr->rotated_n;
           sv = poly_ptr->rotated_vlist;
***************
*** 835,839 ****
                 ZOOMED_HALF_W(poly_ptr->width)))
              return TRUE;
!       } else {
           if (PointOnPoly(XOff, YOff, poly_ptr->rotated_n,
                 poly_ptr->rotated_vlist, ZOOMED_HALF_W(poly_ptr->width)))
--- 837,841 ----
                 ZOOMED_HALF_W(poly_ptr->width)))
              return TRUE;
!       } else if (poly_ptr->rotated_vlist != NULL) {
           if (PointOnPoly(XOff, YOff, poly_ptr->rotated_n,
                 poly_ptr->rotated_vlist, ZOOMED_HALF_W(poly_ptr->width)))
***************
*** 845,849 ****
                 ZOOMED_HALF_W(poly_ptr->width)))
              return TRUE;
!       } else {
           if (PointOnPoly(XOff, YOff, poly_ptr->rotated_n,
                 poly_ptr->rotated_vlist, ZOOMED_HALF_W(poly_ptr->width)))
--- 847,851 ----
                 ZOOMED_HALF_W(poly_ptr->width)))
              return TRUE;
!       } else if (poly_ptr->rotated_vlist != NULL) {
           if (PointOnPoly(XOff, YOff, poly_ptr->rotated_n,
                 poly_ptr->rotated_vlist, ZOOMED_HALF_W(poly_ptr->width)))
***************
*** 854,857 ****
--- 856,861 ----
        sv = poly_ptr->svlist;
        sn = poly_ptr->sn;
+    } else if (poly_ptr->rotated_vlist == NULL) {
+       return FALSE;
     } else {
        sv = poly_ptr->rotated_vlist;
***************
*** 919,923 ****
        return PointOnPoly(XOff, YOff, polygon_ptr->sn, polygon_ptr->svlist,
              ZOOMED_HALF_W(polygon_ptr->width));
!    } else {
        if (!(fill == NONEPAT || (fill == BACKPAT && trans_pat))) {
           if (PointInPolygon(XOff, YOff, polygon_ptr->rotated_n,
--- 923,927 ----
        return PointOnPoly(XOff, YOff, polygon_ptr->sn, polygon_ptr->svlist,
              ZOOMED_HALF_W(polygon_ptr->width));
!    } else if (polygon_ptr->rotated_vlist != NULL) {
        if (!(fill == NONEPAT || (fill == BACKPAT && trans_pat))) {
           if (PointInPolygon(XOff, YOff, polygon_ptr->rotated_n,
***************
*** 929,932 ****
--- 933,937 ----
              polygon_ptr->rotated_vlist, ZOOMED_HALF_W(polygon_ptr->width));
     }
+    return FALSE;
  }
  
***************
*** 1158,1161 ****
--- 1163,1169 ----
     }
     if (ArcObj->ctm != NULL) {
+       if (arc_ptr->rotated_vlist == NULL) {
+          return FALSE;
+       }
        if (!(fill == NONEPAT || (fill == BACKPAT && trans_pat))) {
           if (PointInPolygon(XOff, YOff, arc_ptr->rotated_n+2,
*** util.c.orig	Mon Sep 20 11:28:19 1999
--- util.c	Mon Sep 20 11:28:19 1999
***************
*** 83,87 ****
     if (pszDest == NULL || pszSrc == NULL || nMaxDestSz <= 0) return 0;
  
!    len = min((int)strlen(pszSrc), nMaxDestSz-1);
     strncpy(pszDest, pszSrc, len);
     pszDest[len] = '\0';
--- 83,88 ----
     if (pszDest == NULL || pszSrc == NULL || nMaxDestSz <= 0) return 0;
  
!    len = strlen(pszSrc);
!    if (len > nMaxDestSz-1) len = nMaxDestSz-1;
     strncpy(pszDest, pszSrc, len);
     pszDest[len] = '\0';
*** patchlvl.h.orig	Mon Sep 20 11:28:20 1999
--- patchlvl.h	Mon Sep 20 11:28:20 1999
***************
*** 35,39 ****
  #define _TGIF_PATCHLEVEL_H_
  
! #define TGIF_PATCHLEVEL 19
  
  #endif /*_TGIF_PATCHLEVEL_H_*/
--- 35,39 ----
  #define _TGIF_PATCHLEVEL_H_
  
! #define TGIF_PATCHLEVEL 20
  
  #endif /*_TGIF_PATCHLEVEL_H_*/
*** Imakefile.orig	Mon Sep 20 11:28:20 1999
--- Imakefile	Mon Sep 20 11:28:20 1999
***************
*** 53,57 ****
                    $(MOREDEFINES)
  
! TGIFVERSION	= 4.1.19
  
  XCOMM Things to try to add to the DEFINES line above:
--- 53,57 ----
                    $(MOREDEFINES)
  
! TGIFVERSION	= 4.1.20
  
  XCOMM Things to try to add to the DEFINES line above:
*** HISTORY.orig	Mon Sep 20 11:28:21 1999
--- HISTORY	Mon Sep 20 11:28:21 1999
***************
*** 1,2 ****
--- 1,9 ----
+ -----------------------> tgif-4.1.19 => tgif-4.1.20 <-----------------------
+ 1)  Fix a crashing bug with rotated arcs with very small angles.  Thanks to
+     Rainer Krienke <krienke@uni-koblenz.de> for pointingn out this
+     ancient bug.
+ 2)  Fix a crashing bug when redrawing is interrupted immediately after objects
+     are transformed.
+ 
  -----------------------> tgif-4.1.18 => tgif-4.1.19 <-----------------------
  1)  Fix a crashing bug with the "Edit Attribute In Editor" context menu when
