[vala/staging] codegen: Do not generate generic destroy func for non-disposable structs
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegen: Do not generate generic destroy func for non-disposable structs
- Date: Sat, 5 Apr 2014 16:20:24 +0000 (UTC)
commit 01056a1bc446298a57a546fca41c2d6f1e1c53f2
Author: Luca Bruno <lucabru src gnome org>
Date: Sat Apr 5 18:18:58 2014 +0200
codegen: Do not generate generic destroy func for non-disposable structs
Fixes bug 727652
codegen/valaccodebasemodule.vala | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 8e844a6..200f3b1 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3081,7 +3081,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
} else if (type is ErrorType) {
return new CCodeIdentifier ("g_error_free");
} else if (type.data_type != null) {
- string unref_function;
+ string unref_function = null;
if (type is ReferenceType) {
if (is_reference_counting (type.data_type)) {
unref_function = get_ccode_unref_function ((ObjectTypeSymbol)
type.data_type);
@@ -3101,20 +3101,20 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
}
}
}
- } else {
- if (type.nullable) {
- unref_function = get_ccode_free_function (type.data_type);
- if (unref_function == null) {
- if (type.data_type is Struct && ((Struct)
type.data_type).is_disposable ()) {
- unref_function = generate_free_func_wrapper (type);
- } else {
- unref_function = "g_free";
- }
+ } else if (type.nullable) {
+ unref_function = get_ccode_free_function (type.data_type);
+ if (unref_function == null) {
+ if (type.data_type is Struct && ((Struct)
type.data_type).is_disposable ()) {
+ unref_function = generate_free_func_wrapper (type);
+ } else {
+ unref_function = "g_free";
}
- } else if (type is EnumValueType) {
- unref_function = null;
- } else {
- var st = (Struct) type.data_type;
+ }
+ } else if (type is EnumValueType) {
+ unref_function = null;
+ } else if (type.data_type is Struct) {
+ var st = (Struct) type.data_type;
+ if (st.is_disposable ()) {
if (!get_ccode_has_destroy_function (st)) {
generate_struct_destroy_function (st);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]