]> 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>
Tue, 16 Jan 2007 22:44:34 +0000 (23:44 +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 0d7fdd822bc0fdb320e3bb4ce81182d2df4c06f7..f8da4b2ecdf4ef205e0989baa64b83f85b0ba76c 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 44c16e149fe9b478f55ad39615073718eae03da8..1011d47fdcf1f1a55441cfb31e6f703547880c56 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 edf50f301fef357a4762e8211e41d656a8c27415..073b839d9a1ff874cd9b0f880a665468f82f9d32 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 013f3504638a2c7d867f132a69cab44d265b7f5e..c0d6ff336863d7ff022005257a1276b2eb612a39 100644 (file)
@@ -31,7 +31,7 @@ class Pango_font : public Font_metric
 public:
   SCM physical_font_tab () const;
   Pango_font (PangoFT2FontMap *,
-             PangoFontDescription *,
+             PangoFontDescription const *,
              Real);
   ~Pango_font ();
 
index adca7c5b7038cd6cc05bc636daf5b38f41f4eb3c..f91eafb9844743dd1a6ae89904e5c48ebb0f81b8 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 3a1cafbb199178f61ed7677f1521745b65992117..e9a56ae0e190f269ce0c0ed690c933e0c46defd8 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);