]> git.donarmstrong.com Git - lilypond.git/commitdiff
plug small pango font memory leak.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 16 Jan 2007 22:44:34 +0000 (23:44 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 17 Jan 2007 14:51:09 +0000 (15:51 +0100)
lily/all-font-metrics.cc
lily/grob-smob.cc
lily/include/all-font-metrics.hh
lily/include/pango-font.hh
lily/pango-font.cc
lily/paper-def.cc

index bf2aadd4bb057cc6252538665fe756f2fb9b6b67..282acb770a4dbe11a1cbb9726634854e58b44506 100644 (file)
@@ -65,15 +65,10 @@ All_font_metrics::All_font_metrics (All_font_metrics const &)
 #if HAVE_PANGO_FT2
 
 Pango_font *
-All_font_metrics::find_pango_font (PangoFontDescription *description,
-                                  Real magnification,
+All_font_metrics::find_pango_font (PangoFontDescription const *description,
                                   Real output_scale
                                   )
 {
-  pango_font_description_set_size (description,
-                                  gint (magnification *
-                                        pango_font_description_get_size (description)));
-
   gchar *pango_fn = pango_font_description_to_filename (description);
   SCM key = ly_symbol2scm (pango_fn);
 
index 4fb42c9237d2a707fc0e0460d720e0de3cc57bc8..f3fcb7d2fa44252469de3ee5ccf8f86643562d3d 100644 (file)
@@ -9,6 +9,7 @@
 #include "grob.hh"
 
 #include "paper-score.hh"
+#include "warn.hh"
 
 #include "ly-smobs.icc"
 
@@ -19,6 +20,8 @@ IMPLEMENT_TYPE_P (Grob, "ly:grob?");
 SCM
 Grob::mark_smob (SCM ses)
 {
+  ASSERT_LIVE_IS_ALLOWED();
+  
   Grob *s = (Grob *) SCM_CELL_WORD_1 (ses);
   scm_gc_mark (s->immutable_property_alist_);
 
index 34a05e701f21cb1a5ae16b276ceaa8122b0ab729..33ffacc3274062cbb28060c88b885ec9e0f6eae6 100644 (file)
@@ -43,11 +43,8 @@ public:
   All_font_metrics (string search_path);
   ~All_font_metrics ();
 
-#if HAVE_PANGO_FT2
-  Pango_font *find_pango_font (PangoFontDescription *description,
-                              Real magnification,
+  Pango_font *find_pango_font (PangoFontDescription const *description,
                               Real scale);
-#endif
 
   Font_metric *find_font (string name);
   Open_type_font *find_otf (string name);
index 5449ec0a422cb400b0f9d8d1747060643b48c513..52117459c8521ee12b287c3b1cf87232bba358e8 100644 (file)
@@ -32,7 +32,7 @@ class Pango_font : public Font_metric
 public:
   SCM physical_font_tab () const;
   Pango_font (PangoFT2FontMap *,
-             PangoFontDescription *,
+             PangoFontDescription const *,
              Real);
   ~Pango_font ();
 
index 575c6846be30457fd388ff72d6d667b1b08d003d..4b5b731d1509c37530173e578eb2083e658af8f2 100644 (file)
 #include "stencil.hh"
 
 Pango_font::Pango_font (PangoFT2FontMap *fontmap,
-                       PangoFontDescription *description,
+                       PangoFontDescription const *description,
                        Real output_scale)
 {
   (void) fontmap;
+  
   physical_font_tab_ = scm_c_make_hash_table (11);
   PangoDirection pango_dir = PANGO_DIRECTION_LTR;
   context_
     = pango_ft2_get_context (PANGO_RESOLUTION, PANGO_RESOLUTION);
-  //  context_ = pango_ft2_font_map_create_context (fontmap);
 
   pango_description_ = pango_font_description_copy (description);
   attribute_list_ = pango_attr_list_new ();
index 8a170642616e038022beb00be6cd7ad7488918f1..ef738fc71f4487712e32fed550999d9b8bd8655d 100644 (file)
@@ -80,10 +80,17 @@ find_pango_font (Output_def *layout, SCM descr, Real factor)
 
   PangoFontDescription *description
     = pango_font_description_from_string (scm_i_string_chars (descr));
+
+  pango_font_description_set_size (description,
+                                  gint (factor *
+                                        pango_font_description_get_size (description)));
+
+  
   Font_metric *fm = all_fonts_global->find_pango_font (description,
-                                                      factor,
                                                       output_scale (layout));
 
+  pango_font_description_free (description);
   sizes = scm_acons (size_key, fm->self_scm (), sizes);
   scm_hash_set_x (table, descr, sizes);