[libgdamm] SqlBuilder: get_sql_statement(): Fix memory management.



commit b218e1df74c1bd181906cf0d960f7358f07bfcf2
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu May 13 23:55:25 2010 +0200

    SqlBuilder: get_sql_statement(): Fix memory management.
    
    * libgda/src/sqlbuilder.hg: get_sql_statement(): Take a copy of the C object,
    to avoid a double-free.

 ChangeLog                    |    9 ++++++++-
 libgda/src/sqlbuilder.hg     |    1 +
 tools/m4/convert_libgdamm.m4 |    2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3343d0a..98dc68f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
-2010-05-12  Murray Cumming  <murrayc murrayc-desktop>
+2010-05-13  Murray Cumming  <murrayc murrayc com>
+
+	SqlBuilder: get_sql_statement(): Fix memory management.
+	
+	* libgda/src/sqlbuilder.hg: get_sql_statement(): Take a copy of the C object, 
+	to avoid a double-free.
+
+2010-05-12  Murray Cumming  <murrayc murrayc com>
 
     SqlBuilder: add_sub_select(), compound_add_sub_select(): Remove steal param.
 
diff --git a/libgda/src/sqlbuilder.hg b/libgda/src/sqlbuilder.hg
index 2d14865..d4fc43f 100644
--- a/libgda/src/sqlbuilder.hg
+++ b/libgda/src/sqlbuilder.hg
@@ -50,6 +50,7 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<Statement> get_statement() const, gda_sql_builder_get_statement, errthrow)
 
+#m4 _CONVERSION(`GdaSqlStatement*', `SqlStatement', `Glib::wrap($3, true /* take_copy */)')
   _WRAP_METHOD(SqlStatement get_sql_statement() const, gda_sql_builder_get_sql_statement, errthrow)
 
   _IGNORE(gda_sql_builder_add_expr, gda_sql_builder_add_param, gda_sql_builder_add_cond)
diff --git a/tools/m4/convert_libgdamm.m4 b/tools/m4/convert_libgdamm.m4
index c389d1f..f049969 100644
--- a/tools/m4/convert_libgdamm.m4
+++ b/tools/m4/convert_libgdamm.m4
@@ -158,4 +158,4 @@ _CONVERSION(`const SqlExpr&', `GdaSqlExpr*', `const_cast<GdaSqlExpr*>(($3).gobj(
 _CONVERSION(`GdaSqlExpr*', `SqlExpr', `Glib::wrap($3)')
 
 _CONVERSION(`const SqlStatement&', `GdaSqlStatement*', `const_cast<GdaSqlStatement*>(($3).gobj())')
-_CONVERSION(`GdaSqlStatement*', `SqlStatement', `Glib::wrap($3)')
+



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