[beast] SFI: keep first reference of static GParamSpec structs around



commit 57b0bcbd03d2c7dac78f743fcafe1843cf07d87e
Author: Tim Janik <timj gnu org>
Date:   Mon Oct 22 17:23:25 2012 +0200

    SFI: keep first reference of static GParamSpec structs around

 sfi/sfidl-corecxx.cc |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/sfi/sfidl-corecxx.cc b/sfi/sfidl-corecxx.cc
index a61b6b1..5916f77 100644
--- a/sfi/sfidl-corecxx.cc
+++ b/sfi/sfidl-corecxx.cc
@@ -831,9 +831,11 @@ public:
         printf ("%s::get_element()\n", nname);
         printf ("{\n");
         printf ("  static GParamSpec *element = NULL;\n");
-        printf ("  if (!element)\n");
+        printf ("  if (!element) {\n");
         // printf ("#line %u \"%s\"\n", si->content.line, parser.fileName().c_str());
-        printf ("    element = %s;\n", untyped_pspec_constructor (si->content).c_str());
+        printf ("    element = g_param_spec_ref (%s);\n", untyped_pspec_constructor (si->content).c_str());
+        printf ("    g_param_spec_sink (element);\n");
+        printf ("  }\n");
         printf ("  return element;\n");
         printf ("}\n\n");
       }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]