Intermittent crash in recordingCallback() on app launch

前端 未结 1 756
北荒
北荒 2021-01-16 21:51

My iOS app (using openFrameworks) crashes 30-40% of the time on launch on this line:

    if(soundInputPtr!=NULL) soundInputPtr->audioIn(tempBuffer, ioData         


        
相关标签:
1条回答
  • 2021-01-16 22:21

    Read the stack trace and go where it tells you.

    #0  0x00008ff2 in Gameplay::listen() at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/include/c++/4.2.1/bits/basic_string.h:238
    

    In my copy of that file, that code reads as follows:

      void
      _M_dispose(const _Alloc& __a)
      {
    #ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
        if (__builtin_expect(this != &_S_empty_rep(), false))
    #endif
          if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
                                 -1) <= 0)
            //Line 238:
            _M_destroy(__a);
      }  // XXX MT
    

    Looking elsewhere in the file, that method is called by basic_string's destructor to release the string's private storage (_M_rep()).

    For Objective-C objects, a crash like that generally indicates that the object itself (in this case, the string) was trashed, usually by over-releasing it. But I don't know how applicable that is to C++ objects; a lot of things work differently in C++ vs. Objective-C.

    We can probably tell you more if you show us the code for recordingCallback, making sure to include line 143 of that file (again, see the stack trace for why I'm pointing there).

    0 讨论(0)
提交回复
热议问题