Gst.Object: use 'using' pattern for GValue

This commit is contained in:
Stephan Sundermann 2013-10-10 22:50:34 +02:00
parent d4edf8050d
commit 6f9a3c777e

View file

@ -48,18 +48,17 @@ namespace Gst {
public object this[string property] { public object this[string property] {
get { get {
if (PropertyExists (property)) { if (PropertyExists (property)) {
GLib.Value v = GetProperty (property); using (GLib.Value v = GetProperty (property)) {
object o = v.Val; return v.Val;
v.Dispose (); }
return o;
} else } else
throw new PropertyNotFoundException (); throw new PropertyNotFoundException ();
} set { } set {
if (PropertyExists (property)) { if (PropertyExists (property)) {
GLib.Value v = new GLib.Value (this, property); using (GLib.Value v = new GLib.Value (this, property)) {
v.Val = value; v.Val = value;
SetProperty (property, v); SetProperty (property, v);
v.Dispose (); }
} else } else
throw new PropertyNotFoundException (); throw new PropertyNotFoundException ();
} }