SigSegv error in UITableViewSource GetCell after Add rows to UITableView

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

SigSegv error in UITableViewSource GetCell after Add rows to UITableView

gabriel_morales
This post was updated on .
Hi I'm getting a Sigsegv error after add rows to uitableview
this is my code:
this method it called after callback from server request
public void addContacts(){
                        InvokeOnMainThread (delegate {
                                try{
                                        items.AddRange(itemsAdd);//Add to tableview data
                                        tableContact.ReloadData();
                                        tableContact.SetNeedsLayout();

                                }catch(Exception e){
                                        Console.WriteLine(e.StackTrace);
                                }
                                ICLayoutMgr.Get().SetBusy(false);
                                tableContact.ScrollEnabled = true;
                        });
                }

GetCell Method
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
                {
                        var cell = tableView.DequeueReusableCell (cellIdentifier) as ICTableContactCell;
                                var itemC = tableItems [indexPath.Row];
                                if (cell == null) {
                                        cell = new ICTableContactCell (itemC, new NSString (cellIdentifier));
                                        if(cells==null){
                                                cells=new List<ICTableContactCell>();
                                        }
                                        cells.Add(cell);
                                }
                                itemC.index = indexPath.Row;
                                if(itemC!=null)
                                        cell.UpdateCell (itemC);

                        return cell as UITableViewCell;
                }

the error log

Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: Stacktrace:
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>:   at <unknown> <0xffffffff>
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>:   at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0xffffffff>
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>:   at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/.pmcs-compat.UIApplication.cs:38
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>:   at CardReader_iOS.Application.Main (string[]) [0x00008] in /Users/developer/Documents/InstantCustomerDev/instantcustomerdev/InstantCustomer/CardReader_iOS/CardReader_iOS/Main.cs:18
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>:   at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>:
        Native stacktrace:
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 0   CardReader_iOS                      0x00332ed5 mono_handle_native_sigsegv + 260
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 1   CardReader_iOS                      0x0033bfad mono_sigsegv_signal_handler + 176
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 2   libsystem_platform.dylib            0x3a1c1063 _sigtramp + 42
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 3   CardReader_iOS                      0x0004d84c CardReader_iOS_ICTableContactSource_GetCell_MonoTouch_UIKit_UITableView_MonoTouch_Foundation_NSIndexPath + 344
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 4   CardReader_iOS                      0x001f10d0 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 5   CardReader_iOS                      0x0033e087 mono_jit_runtime_invoke + 1134
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 6   CardReader_iOS                      0x00378d2d mono_runtime_invoke + 88
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 7   CardReader_iOS                      0x0030e4af native_to_managed_trampoline_CardReader_iOS_ICTableContactSource_GetCell + 402
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 8   UIKit                               0x3212ea5b <redacted> + 410
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 9   UIKit                               0x320d6e7d <redacted> + 1804
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 10  UIKit                               0x320d6699 <redacted> + 184
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 11  UIKit                               0x31ffcda3 <redacted> + 346
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 12  QuartzCore                          0x31c83c6b <redacted> + 142
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 13  QuartzCore                          0x31c7f47b <redacted> + 350
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 14  QuartzCore                          0x31c7f30d <redacted> + 16
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 15  QuartzCore                          0x31c7ed1f <redacted> + 230
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 16  QuartzCore                          0x31c7eb2f <redacted> + 314
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 17  QuartzCore                          0x31cd3825 <redacted> + 516
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 18  IOMobileFramebuffer                 0x348c976d <redacted> + 104
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 19  IOKit                               0x3056ba75 IODispatchCalloutFromCFMessage + 248
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 20  CoreFoundation                      0x2f849e21 <redacted> + 136
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 21  CoreFoundation                      0x2f8549df <redacted> + 34
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 22  CoreFoundation                      0x2f85497b <redacted> + 346
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 23  CoreFoundation                      0x2f85314f <redacted> + 1398
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 24  CoreFoundation                      0x2f7bdc27 CFRunLoopRunSpecific + 522
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 25  CoreFoundation                      0x2f7bda0b CFRunLoopRunInMode + 106
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 26  GraphicsServices                    0x344ad283 GSEventRunModal + 138
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 27  UIKit                               0x32061049 UIApplicationMain + 1136
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 28  CardReader_iOS                      0x000e3ef8 wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 272
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 29  CardReader_iOS                      0x000c02b4 MonoTouch_UIKit_UIApplication_Main_string___string_string + 300
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 30  CardReader_iOS                      0x00027148 CardReader_iOS_Application_Main_string__ + 172
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 31  CardReader_iOS                      0x001f10d0 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 32  CardReader_iOS                      0x0033e087 mono_jit_runtime_invoke + 1134
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 33  CardReader_iOS                      0x00378d2d mono_runtime_invoke + 88
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 34  CardReader_iOS                      0x0037c8b5 mono_runtime_exec_main + 276
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 35  CardReader_iOS                      0x0037c705 mono_runtime_run_main + 424
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 36  CardReader_iOS                      0x0032c6e1 mono_jit_exec + 48
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 37  CardReader_iOS                      0x003af704 main + 2468
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>: 38  libdyld.dylib                       0x3a0a6ab7 <redacted> + 2
Feb 26 17:50:16 iPod-touch CardReader_iOS[324] <Error>:
        =================================================================
        Got a SIGSEGV while executing native code. This usually indicates
        a fatal error in the mono runtime or one of the native libraries
        used by your application.
        =================================================================


after multiple test
Console.WriteLine ("here 1 ");
                        var cell = tableView.DequeueReusableCell ("contactCellID") as ICTableContactCell;
                        Console.WriteLine ("here 1/2");
                        Console.WriteLine ("here 2 "+(tableItems==null));
                        Console.WriteLine ("here 2 "+(tableItems.Count));
                        Console.WriteLine ("here 2 "+(indexPath==null));
                        Console.WriteLine ("here 2 "+(indexPath.Row));
                        Console.WriteLine ("here 2 "+(tableItems.Count)+" - "+(indexPath==null)+" "+(indexPath.Row));
                        var item = tableItems [indexPath.Row];
haciendo esto el error se dispara
Feb 27 12:42:02 Developers-iPod CardReader_iOS[1480] <Warning>: here 1
Feb 27 12:42:02 Developers-iPod CardReader_iOS[1480] <Warning>: here 1/2
Feb 27 12:42:02 Developers-iPod CardReader_iOS[1480] <Warning>: here 2 False
Feb 27 12:42:02 Developers-iPod CardReader_iOS[1480] <Warning>: here 2 409
Feb 27 12:42:02 Developers-iPod CardReader_iOS[1480] <Warning>: here 2 False

the error jump on indexPath.Row how can I fix that??
Reply | Threaded
Open this post in threaded view
|

Re: SigSegv error in UITableViewSource GetCell after Add rows to UITableView

Nic Wise
> GetCell Method
> public override UITableViewCell GetCell (UITableView tableView, NSIndexPath
> indexPath)
>                 {
>                         var cell = tableView.DequeueReusableCell (cellIdentifier) as
> ICTableContactCell;
>                                 var itemC = tableItems [indexPath.Row];
>                                 if (cell == null) {
>                                         cell = new ICTableContactCell (itemC, new NSString (cellIdentifier));
>                                         if(cells==null){
>                                                 cells=new List<ICTableContactCell>();
>                                         }
>                                         cells.Add(cell);

Why are you keeping a reference to each cell? Surely this is going to
break the reusable pattern? IF you need to do this, dont use
DequeueReusableCell, just make a new one each time (but I recommend
you DONT do this)


>                                 }
>                                 itemC.index = indexPath.Row;
>                                 if(itemC!=null)
>                                         cell.UpdateCell (itemC);
>
>                         return cell as UITableViewCell;

Pretty sure you dont need to cast on the way out. If
ICTableContactCell isn't a descendant of UITableViewCell, it needs to
be changed.

Other than that, maybe use the dSYM to work out which line of code?
Nothing obvious in there otherwise


--
Nic Wise
t.  +64 21 676 418 | @fastchicken
b. http://www.fastchicken.co.nz/
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|

Re: SigSegv error in UITableViewSource GetCell after Add rows to UITableView

gabriel_morales
Hi Nic thanks for the answer, I have done what you say, but  still is crashing, how can I see the line errors with dsym? I have the .app .app.desym and .exe files and save it the console log from xcode into a log.crash
I'm running the app in device in Release mode, this crash only happens on device nothing happens on simulator
Reply | Threaded
Open this post in threaded view
|

Re: SigSegv error in UITableViewSource GetCell after Add rows to UITableView

gabriel_morales
In reply to this post by gabriel_morales
I found a solution the NSIndexPath in the crash it's a NSActionDispatcher so I'm controlling that with the indexPath.GetType() and when isn't a NSIndexPath I'm using the las working index stored in a global variable, this error it's a bug from iOS 7 for UITableView and ContentView