1

I have a codenameOne app that works fine on Android but occasionally crashes on iOS.

From xcode it looks like its failing at:

JAVA_VOID java_lang_Thread_releaseThreadNativeResources___long(CODENAME_ONE_THREAD_STATE, JAVA_LONG nativeThreadId) {
for(int i = 0 ; i < NUMBER_OF_SUPPORTED_THREADS ; i++) {
    if(threadsToDelete[i] != 0 && threadsToDelete[i]->threadId == nativeThreadId) {
        free(threadsToDelete[i]->blocks);
        free(threadsToDelete[i]->threadObjectStack);
        free(threadsToDelete[i]->callStackClass);
        free(threadsToDelete[i]->callStackLine);
        free(threadsToDelete[i]->callStackMethod);
        free(threadsToDelete[i]->pendingHeapAllocations);
        free(threadsToDelete[i]);

        threadsToDelete[i] = 0;
        break;
    }
}

}

in nativeMethods.m. It says threadsToDelete is null in that if statement. This seems to happen when I open a new form showing a picture, then switch back to the original form. I do start a new thread to save certain details to amazon. But it doesn't crash everytime. enter image description here

4
  • On which line above does it say that it's 0? Is the entry within the array 0 or is the array threadsToDelete itself 0? Is there a way you can reproduce this with a simple test case?
    – Shai Almog
    Commented Jul 20, 2016 at 4:37
  • Line 3, the if statement, threadsToDelete[i] is null. I don't know how to reproduce with a simple test case sorry. I don't know enough about what this code is doing to figure out which part of my app could be causing it. Like I said, I start a few threads for various background tasks. If you have any ideas on what could cause this, I may be able to figure out a test case?
    – Karry
    Commented Jul 21, 2016 at 2:06
  • if threadsToDelete[i] == 0 this is fine as that is a valid state tested here. If threadsToDelete is 0 that would be a problem. Can you post the stack trace from xcode?
    – Shai Almog
    Commented Jul 21, 2016 at 4:23
  • @shaiAlmog I am so completely new to xcode I can't even figure out how to get a copy of the stacktrace sorry, but I've added a screenshot if that helps?
    – Karry
    Commented Jul 22, 2016 at 8:03

1 Answer 1

1

I have fixed this issue in Github here. It will be included with the next build server update (probably today, possibly next week).

1
  • Thanks! Appreciate all your help.
    – Karry
    Commented Jul 24, 2016 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.