changeset 11259:fe11e2b9d48a

eliminate text engine memory leak
author John W. Eaton <jwe@octave.org>
date Wed, 17 Nov 2010 03:04:03 -0500
parents 795c97ace02c
children fd18ba11af57
files src/graphics.cc src/txt-eng.h
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/graphics.cc	Wed Nov 17 02:40:43 2010 -0500
+++ b/src/graphics.cc	Wed Nov 17 03:04:03 2010 -0500
@@ -5043,6 +5043,8 @@
 #endif
   box = text_renderer.get_extent (elt, get_rotation ());
 
+  delete elt;
+
   Matrix ext (1, 4, 0.0);
 
   // FIXME: also handle left and bottom components
--- a/src/txt-eng.h	Wed Nov 17 02:40:43 2010 -0500
+++ b/src/txt-eng.h	Wed Nov 17 03:04:03 2010 -0500
@@ -179,6 +179,11 @@
 
   ~text_parser_none (void) { }
 
+  // FIXME: is it possible to use reference counting to manage the
+  // memory for the object returned by the text parser?  That would be
+  // preferable to having to know when and where to delete the object it
+  // creates...
+
   text_element* parse (const std::string& s)
     {
       return new text_element_string (s);