generator: Set Owned to false when ownership of a parameter changes

This fixes an issue where unref would get called too often because the
ownership has changed when passing an instance to the native side.

See https://github.com/mono/gtk-sharp/pull/112 for more details.
This commit is contained in:
Stephan Sundermann 2014-08-05 11:33:52 +02:00 committed by Bertrand Lorentz
parent 961b9ef348
commit 8e0de299e4

View File

@ -290,6 +290,8 @@ namespace GtkSharp.Generation {
return new string [] { gen.MarshalType + " native_" + CallName + ";" };
} else if (PassAs == "ref" && CSType != MarshalType) {
return new string [] { gen.MarshalType + " native_" + CallName + " = (" + gen.MarshalType + ") " + CallName + ";" };
} else if (gen is OpaqueGen && Owned) {
return new string [] { CallName + ".Owned = false;" };
}
return new string [0];