changeset 3479:2b84dd8eb906

[xemacs-hg @ 2006-06-27 22:59:37 by james] Don't leak Dynarr's in redisplay. <m3sllwwxja.fsf@jerrypc.cs.usu.edu>
author james
date Tue, 27 Jun 2006 22:59:40 +0000
parents 222e933cef23
children 49226be71b89
files src/ChangeLog src/redisplay-gtk.c src/redisplay-msw.c src/redisplay-output.c src/redisplay-tty.c src/redisplay-x.c
diffstat 6 files changed, 20 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Jun 27 21:51:09 2006 +0000
+++ b/src/ChangeLog	Tue Jun 27 22:59:40 2006 +0000
@@ -1,3 +1,12 @@
+2006-06-22  Jerry James  <james@xemacs.org>
+
+	* redisplay-gtk.c (gtk_output_display_block): Fix a Dynarr leak.
+	Don't create the buffer if there is nothing to do.
+	* redisplay-msw.c (mswindows_output_display_block): Ditto.
+	* redisplay-output.c (redisplay_output_layout): Ditto.
+	* redisplay-tty.c (tty_output_display_block): Ditto.
+	* redisplay-x.c (x_output_display_block): Ditto.
+
 2006-06-23  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* font-mgr.c (extract_fcapi_string):
--- a/src/redisplay-gtk.c	Tue Jun 27 21:51:09 2006 +0000
+++ b/src/redisplay-gtk.c	Tue Jun 27 22:59:40 2006 +0000
@@ -293,7 +293,7 @@
 			  int cursor_width, int cursor_height)
 {
   struct frame *f = XFRAME (w->frame);
-  Ichar_dynarr *buf = Dynarr_new (Ichar);
+  Ichar_dynarr *buf;
   Lisp_Object window;
 
   struct display_block *db = Dynarr_atp (dl->display_blocks, block);
@@ -325,7 +325,7 @@
 
   if (end < 0)
     end = Dynarr_length (rba);
-  Dynarr_reset (buf);
+  buf = Dynarr_new (Ichar);
 
   while (elt < end)
     {
--- a/src/redisplay-msw.c	Tue Jun 27 21:51:09 2006 +0000
+++ b/src/redisplay-msw.c	Tue Jun 27 22:59:40 2006 +0000
@@ -907,7 +907,7 @@
 				int cursor_width, int cursor_height)
 {
   struct frame *f = XFRAME (w->frame);
-  Ichar_dynarr *buf = Dynarr_new (Ichar);
+  Ichar_dynarr *buf;
   Lisp_Object window;
 
   struct display_block *db = Dynarr_atp (dl->display_blocks, block);
@@ -934,7 +934,7 @@
 
   if (end < 0)
     end = Dynarr_length (rba);
-  Dynarr_reset (buf);
+  buf = Dynarr_new (Ichar);
 
   while (elt < end)
     {
--- a/src/redisplay-output.c	Tue Jun 27 21:51:09 2006 +0000
+++ b/src/redisplay-output.c	Tue Jun 27 22:59:40 2006 +0000
@@ -1407,7 +1407,7 @@
 {
   Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
   Lisp_Object rest, window = DOMAIN_WINDOW (domain);
-  Ichar_dynarr *buf = Dynarr_new (Ichar);
+  Ichar_dynarr *buf;
   struct window *w = XWINDOW (window);
   struct device *d = DOMAIN_XDEVICE (domain);
   int layout_height, layout_width;
@@ -1424,6 +1424,8 @@
   if (!redisplay_normalize_glyph_area (db, dga))
     return;
 
+  buf = Dynarr_new (Ichar);
+
   /* Highly dodgy optimization. We want to only output the whole
      layout if we really have to. */
   if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p)
--- a/src/redisplay-tty.c	Tue Jun 27 21:51:09 2006 +0000
+++ b/src/redisplay-tty.c	Tue Jun 27 22:59:40 2006 +0000
@@ -206,7 +206,7 @@
 			  int UNUSED (cursor_height))
 {
   struct frame *f = XFRAME (w->frame);
-  Ichar_dynarr *buf = Dynarr_new (Ichar);
+  Ichar_dynarr *buf;
 
   struct display_block *db = Dynarr_atp (dl->display_blocks, block);
   rune_dynarr *rba = db->runes;
@@ -232,7 +232,7 @@
   if (end < 0)
     end = Dynarr_length (rba);
 
-  Dynarr_reset (buf);
+  buf = Dynarr_new (Ichar);
 
   while (elt < end && Dynarr_atp (rba, elt)->xpos < start_pixpos)
     {
--- a/src/redisplay-x.c	Tue Jun 27 21:51:09 2006 +0000
+++ b/src/redisplay-x.c	Tue Jun 27 22:59:40 2006 +0000
@@ -432,7 +432,7 @@
 #ifndef USE_XFT
   struct frame *f = XFRAME (w->frame);
 #endif
-  Ichar_dynarr *buf = Dynarr_new (Ichar);
+  Ichar_dynarr *buf;
   Lisp_Object window;
 
   struct display_block *db = Dynarr_atp (dl->display_blocks, block);
@@ -459,7 +459,7 @@
 
   if (end < 0)
     end = Dynarr_length (rba);
-  Dynarr_reset (buf);
+  buf = Dynarr_new (Ichar);
 
   while (elt < end)
     {