Bug 6399 - xfig crashes when using "paste" after "del to cut buf"
xfig crashes when using "paste" after "del to cut buf"
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: xfig (Show other bugs)
6.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Preston Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-10-26 18:04 EDT by rolf.mueller
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-01-14 11:28:20 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description rolf.mueller 1999-10-26 18:04:42 EDT
Bug:
create any object (e.g. circle, polyline, ...)
select delete action
delete object with right mouse button ("del to cut buf")
press "Paste" in main menu bar (horiz. bar on top)
move mouse back over drawing window
result: xfig first uses lots of cpu & mem, than
segfaults.

I have a patch for this bug, which was sent to me by
Brian V. Smith <xfigmail@epb1.lbl.gov>, the maintainer of
xfig, it works under Redhat 6.1:

The patch is pasted in below, I don't know if it is helpful.
I can e-mail it to you, if you like.

*** d_text.c.orig       Fri Jun 12 09:27:52 1998
--- d_text.c    Mon Jul  6 11:28:44 1998
***************
*** 139,144 ****
--- 139,145 ----
      }
  #endif  /* I18N_NO_PREEDIT */
  #endif  /* I18N */
+     reset_action_on();
      clear_mousefun_kbd();
      set_cursor(pencil_cursor);
      is_newline = 0;
*** mode.h.orig Wed Jul  1 17:04:58 1998
--- mode.h      Mon Jul  6 11:50:58 1998
***************
*** 37,42 ****
--- 37,43 ----
  #define               F_REGPOLY               15
  #define               F_PICOBJ                16
  #define               F_PLACE_LIB_OBJ         17
+ #define               F_PASTE                 18

  #define           FIRST_EDIT_MODE         F_GLUE
  #define               F_GLUE                  30
*** u_redraw.c.orig     Tue Jun 30 16:22:07 1998
--- u_redraw.c  Fri Jul 31 18:01:49 1998
***************
*** 25,30 ****
--- 25,31 ----
  #include "e_rotate.h"
  #include "u_draw.h"
  #include "w_canvas.h"
+ #include "w_file.h"
  #include "w_setup.h"
  #include "w_util.h"
  #include "w_zoom.h"
***************
*** 424,432 ****

      /* find which type of object we need to refresh */

!     if (cur_mode >= FIRST_EDIT_MODE && canvas_locmove_proc
!= null_proc) {
!       (*canvas_locmove_proc)(last_x, last_y);
!     } else {
        switch (cur_mode) {
        case F_PICOBJ:
        case F_ARC_BOX:
--- 429,435 ----

      /* find which type of object we need to refresh */

!     if (cur_mode < FIRST_EDIT_MODE) {
        switch (cur_mode) {
        case F_PICOBJ:
        case F_ARC_BOX:
***************
*** 495,500 ****
--- 498,507 ----
  redisplay_region(xmin, ymin, xmax, ymax)
      int                   xmin, ymin, xmax, ymax;
  {
+     /* if we're generating a preview, don't redisplay the
canvas */
+     if (preview_in_progress)
+       return;
+
      set_temp_cursor(wait_cursor);
      /* kludge so that markers are redrawn */
      xmin -= 10;
*** w_cmdpanel.c.orig   Tue Aug 18 15:02:33 1998
--- w_cmdpanel.c        Tue Aug 18 15:01:02 1998
***************
*** 59,65 ****
--- 59,72 ----
  void          new();
  void          delete_all_cmd();
  void          paste();
+ static void   init_move_object(),move_object();
+ static void   place_object(),cancel_paste();
+ static void   put_draw();
+ static void   place_object_orig_posn();

+ static int
cur_paste_x,cur_paste_y,off_paste_x,off_paste_y;
+ static int    orig_paste_x,orig_paste_y;
+
  /* popup message over button when mouse enters it */
  static void     cmd_balloon_trigger();
  static void     cmd_unballoon();
***************
*** 453,463 ****
      exit(0);
  }

- static void   init_move_object(),move_object();
- static void   place_object(),cancel_paste();
- static void   put_draw();
- static int
cur_paste_x,cur_paste_y,off_paste_x,off_paste_y;
-
  void
  paste(w)
      Widget        w;
--- 460,465 ----
***************
*** 471,479 ****

        set_cursor(wait_cursor);
        turn_off_current();
!       set_mousefun("place object","","cancel paste",
!                       "place object", "", "cancel paste");
        set_action_on();
        cur_c = create_compound();
        cur_c->parent = NULL;
        cur_c->GABPtr = NULL;
--- 473,484 ----

        set_cursor(wait_cursor);
        turn_off_current();
!       set_mousefun("place object","place at orig
posn","cancel paste",
!                       "place object", "place at orig
posn", "cancel paste");
!       /* set to paste mode */
        set_action_on();
+       cur_mode = F_PASTE;
+
        cur_c = create_compound();
        cur_c->parent = NULL;
        cur_c->GABPtr = NULL;
***************
*** 493,498 ****
--- 498,508 ----
                             &cur_c->secorner.x,
                             &cur_c->secorner.y);

+               /* save orig coords of object */
+               orig_paste_x = cur_c->nwcorner.x;
+               orig_paste_y = cur_c->nwcorner.y;
+
+               /* make it relative for mouse positioning */
                translate_compound(cur_c,-cur_c->nwcorner.x,
-cur_c->nwcorner.y);
        } else {
                /* an error reading a .fig file */
***************
*** 516,522 ****
        off_paste_y=new_c->secorner.y;
        canvas_locmove_proc = init_move_object;
        canvas_leftbut_proc = place_object;
!       canvas_middlebut_proc = null_proc;
        canvas_rightbut_proc = cancel_paste;

        /* set crosshair cursor */
--- 526,532 ----
        off_paste_y=new_c->secorner.y;
        canvas_locmove_proc = init_move_object;
        canvas_leftbut_proc = place_object;
!       canvas_middlebut_proc = place_object_orig_posn;
        canvas_rightbut_proc = cancel_paste;

        /* set crosshair cursor */
***************
*** 577,584 ****
  init_move_object(x, y)
      int                   x, y;
  {
!     cur_paste_x=x;
!     cur_paste_y=y;
      translate_compound(new_c,x,y);

      put_draw(PAINT);
--- 587,594 ----
  init_move_object(x, y)
      int                   x, y;
  {
!     cur_paste_x = x;
!     cur_paste_y = y;
      translate_compound(new_c,x,y);

      put_draw(PAINT);
***************
*** 585,601 ****
      canvas_locmove_proc = move_object;
  }

  static void
  place_object(x, y, shift)
      int                   x, y;
      unsigned int    shift;
  {
-     canvas_leftbut_proc = null_proc;
-     canvas_middlebut_proc = null_proc;
-     canvas_rightbut_proc = null_proc;
-     canvas_locmove_proc = null_proc;
      put_draw(ERASE);
      clean_up();
      add_compound(new_c);
      set_modifiedflag();
      redisplay_compound(new_c);
--- 595,630 ----
      canvas_locmove_proc = move_object;
  }

+ /* button 1: paste object at current position of mouse */
+
  static void
  place_object(x, y, shift)
      int                   x, y;
      unsigned int    shift;
  {
      put_draw(ERASE);
      clean_up();
+     add_compound(new_c);
+     set_modifiedflag();
+     redisplay_compound(new_c);
+     cancel_paste();
+ }
+
+ /* button 2: paste object in original location whence it
came */
+
+ static void
+ place_object_orig_posn(x, y, shift)
+     int                   x, y;
+     unsigned int    shift;
+ {
+     int dx,dy;
+
+     put_draw(ERASE);
+     clean_up();
+     /* move back to original position */
+     dx = orig_paste_x-x;
+     dy = orig_paste_y-y;
+     translate_compound(new_c,dx,dy);
      add_compound(new_c);
      set_modifiedflag();
      redisplay_compound(new_c);
Comment 1 Preston Brown 2000-01-14 11:28:59 EST
fixed for next release.

Note You need to log in before you can comment on or make changes to this bug.