[vala/staging] codegen: Do not generate generic destroy func for non-disposable structs



commit 4f7ae816baba53b5482c1a42f07247d332db8a98
Author: Simon Werbeck <simon werbeck gmail com>
Date:   Sat Apr 5 13:11:51 2014 +0200

    codegen: Do not generate generic destroy func for non-disposable structs
    
    Fixes bug 727652

 codegen/valaccodebasemodule.vala |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 8e844a6..8b097f5 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3115,10 +3115,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        unref_function = null;
                                } else {
                                        var st = (Struct) type.data_type;
-                                       if (!get_ccode_has_destroy_function (st)) {
-                                               generate_struct_destroy_function (st);
+                                       if (st.is_disposable ()) {
+                                               if (!get_ccode_has_destroy_function (st)) {
+                                                       generate_struct_destroy_function (st);
+                                               }
+                                               unref_function = get_ccode_destroy_function (st);
+                                       } else {
+                                               unref_function = null;
                                        }
-                                       unref_function = get_ccode_destroy_function (st);
                                }
                        }
                        if (unref_function == null) {


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