NSArray绑定中偶尔出现SIGSEGV [英] Occasional SIGSEGV in NSArray binding

查看:81
本文介绍了NSArray绑定中偶尔出现SIGSEGV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有要绑定的以下属性:

I have the following property that I am binding:

@property (nonatomic, readwrite, retain) NSArray* activeTasks;

我绑定了以下代码:

[Export("activeTasks", ArgumentSemantic.Retain)]
NSDictionary[] ActiveTasks { get; } 

我经常使用此属性.不过,每进行1000次访问,我就在get_activeTasks(选择器的绑定)上得到一个SIGSEGV.我想知道我在做什么错,为什么这种情况很少发生,而不是系统地发生.

I use this property very often. Nevertheless, once every thousand of accesses, I get a SIGSEGV on get_activeTasks (the binding of the selector). I wonder what I am doing wrong and why this only happens very rarely instead of systematically.

  at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend (intptr,intptr) <IL 0x00024, 0xffffffff>
  at MonoTouch.Foundation.NSObject.InitializeObject (bool) [0x00062] in /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.cs:136
  at MonoTouch.Foundation.NSObject..ctor (intptr,bool) [0x0000d] in /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.cs:62
  at MonoTouch.Foundation.NSObject..ctor (intptr) <IL 0x00003, 0x0002b>
  at MonoTouch.Foundation.NSDictionary..ctor (intptr) <IL 0x00002, 0x00027>
  at MonoTouch.Foundation.NSMutableDictionary..ctor (intptr) <IL 0x00002, 0x00027>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___intptr (object,intptr,intptr,intptr) <IL 0x00054, 0xffffffff>
  at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&) <IL 0x00030, 0xffffffff>
  at System.Reflection.MonoCMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00109] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:536
  at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:551
  at System.Activator.CreateInstance (System.Type,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo,object[]) [0x00174] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:299
  at System.Activator.CreateInstance (System.Type,object[],object[]) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:234
  at System.Activator.CreateInstance (System.Type,object[]) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:229
  at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (intptr,intptr) [0x0000d] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:210
  at MonoTouch.ObjCRuntime.Runtime.GetNSObject (intptr) [0x0001f] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:259
  at MonoTouch.Foundation.NSArray.ArrayFromHandle<T> (intptr) [0x0003a] in /Developer/MonoTouch/Source/monotouch/src/shared/Foundation/NSArray.cs:172
  at TouchDBBinding.CouchServer.get_ActiveTasks () <IL 0x0001b, 0x00073>

这是使用新框架的更新堆栈跟踪,我不知道它是否可以提供更多帮助:

Here is an update stack trace using the new Framework, I don't know if it could help out more:

Stacktrace:

Stacktrace:

 at (wrapper managed-to-native) MonoTouch.Foundation.NSObject.monotouch_create_managed_ref (intptr,intptr,bool) <IL 0x0002d, 0xffffffff>
  at MonoTouch.Foundation.NSObject.CreateManagedRef (bool) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.cs:93
  at MonoTouch.Foundation.NSObject.InitializeObject (bool) [0x000cc] in /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.cs:88
  at MonoTouch.Foundation.NSObject..ctor (intptr,bool) [0x0000d] in /Developer/MonoTouch/Source/monotouch/src/shared/Foundation/NSObject2.cs:85
  at MonoTouch.Foundation.NSObject..ctor (intptr) <IL 0x00003, 0x0002b>
  at MonoTouch.Foundation.NSDictionary..ctor (intptr) <IL 0x00002, 0x00027>
  at MonoTouch.Foundation.NSMutableDictionary..ctor (intptr) <IL 0x00002, 0x00027>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___intptr (object,intptr,intptr,intptr) <IL 0x00054, 0xffffffff>
  at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&) <IL 0x00030, 0xffffffff>
  at System.Reflection.MonoCMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00109] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:530
  at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:545
  at System.Reflection.ConstructorInfo.Invoke (object[]) [0x0000e] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/ConstructorInfo.cs:62
  at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (intptr,intptr) [0x00051] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:269
  at MonoTouch.ObjCRuntime.Runtime.GetNSObject (intptr) [0x0001f] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:328
  at MonoTouch.Foundation.NSArray.ArrayFromHandle<T> (intptr) [0x00044] in /Developer/MonoTouch/Source/monotouch/src/shared/Foundation/NSArray.cs:188
  at TouchDBBinding.CouchServer.get_ActiveTasks () <IL 0x0001b, 0x00073>

当带有保留的NSArray *绑定到NSDictionary []且此属性为null时,MonoTouch的内部工作中是否可能会出现问题?还是可能是因为其内容为空?

Is it possible that there is something in the inner workings of MonoTouch that can be a problem when an NSArray* with retain is bound to an NSDictionary[] and that this said property is null? Or is it possible that it is because it has null content?

谢谢, 保罗

推荐答案

堆栈跟踪表明当MonoTouch尝试保留NSArray的元素之一时发生崩溃.

The stack trace indicates that the crash happens when MonoTouch tries to retain one of the elements of the NSArray.

一个可能的原因是特定元素已经被释放(或被破坏).特别是不是因为元素为null(这种情况的处理方式有所不同).

One possible reason is that the particular element has already been freed (or is otherwise corrupted). In particular it is not because the element is null (this case is handled differently).

这篇关于NSArray绑定中偶尔出现SIGSEGV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆