mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
Iterator: Next try to fix crashes
This commit is contained in:
parent
3a2d6750f1
commit
7d6ad28a35
2 changed files with 13 additions and 4 deletions
|
@ -34,6 +34,15 @@ namespace Gst {
|
|||
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_value_reset (ref GLib.Value val);
|
||||
|
||||
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern int gst_iterator_next(IntPtr raw, ref GLib.Value elem);
|
||||
|
||||
public Gst.IteratorResult Next(ref GLib.Value elem) {
|
||||
int raw_ret = gst_iterator_next(Handle, ref elem);
|
||||
Gst.IteratorResult ret = (Gst.IteratorResult) raw_ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
private class Enumerator : IEnumerator {
|
||||
Iterator iterator;
|
||||
Hashtable seen = new Hashtable ();
|
||||
|
@ -53,11 +62,10 @@ namespace Gst {
|
|||
return false;
|
||||
|
||||
do {
|
||||
GLib.Value value = new GLib.Value ();
|
||||
IntPtr ptr = g_value_reset (ref value);
|
||||
value = (GLib.Value) Marshal.PtrToStructure (ptr, typeof(GLib.Value));
|
||||
GLib.Value value = new GLib.Value (GLib.GType.Boolean);
|
||||
value.Dispose ();
|
||||
|
||||
IteratorResult ret = iterator.Next (out value);
|
||||
IteratorResult ret = iterator.Next (ref value);
|
||||
|
||||
switch (ret) {
|
||||
case IteratorResult.Done:
|
||||
|
|
|
@ -49,6 +49,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
<attr path="/api/namespace/struct[@cname='GstStructure']" name="native">true</attr>
|
||||
<change-node-type path="/api/namespace//boxed[@cname='GstIterator']">struct</change-node-type>
|
||||
<attr path="/api/namespace/struct[@cname='GstIterator']" name="native">true</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GstIterator']/method[@cname='gst_iterator_next']" name="hidden">true</attr>
|
||||
<remove-node path="/api/namespace/boxed[@cname='GstStructure']/field[@cname='name']" />
|
||||
<!-- Maybe some problems with the name -->
|
||||
<remove-node path="/api/namespace/interface[@cname='GstURIHandler']/class_struct/method[@vm='get_type']" name="vm" />
|
||||
|
|
Loading…
Reference in a new issue