Sporadic crash


    Aug 01 2016 | 12:52 pm
    Hi all, I have an occasional crash in the following code:
    jit_attr_setfloat_array( m_p_render, gensym("erase_color"), 4, draw_bg ? COL_BLACK : bg ); jit_object_method( m_p_render, gensym( "erase" ) );
    jit_atom_setsym( &a, gensym( p_str ) ); jit_object_method_typed( m_p_text, gensym( "text"), 1, &a, NULL );
    jit_object_method( m_p_render, gensym( "drawclients" ) );
    The erase call works fine so the m_p_render object is good at that point. The crash is a SIGSEGV.
    Just wondering what can cause the 'drawclients' to crash so I can try and figure out what it is - as said, it's an occasional crash, though can't seem to tie any particular circumstance to it.
    Thanks for any insight!

    • Aug 01 2016 | 4:13 pm
      Hard to know without more info (crash log, example patch, full source, etc.)
    • Aug 03 2016 | 9:07 am
      I'll try and get a crash log for it. Been running in the debugger to try and get a handle on it so will let it happen outside... cheers
    • Aug 21 2016 | 8:42 am
      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fff994c5f06 __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff9c91c4ec pthread_kill + 90 2 libsystem_c.dylib 0x00007fff8ede16df abort + 129 3 libsystem_malloc.dylib 0x00007fff8c414396 szone_error + 626 4 libsystem_malloc.dylib 0x00007fff8c409da6 small_malloc_from_free_list + 258 5 libsystem_malloc.dylib 0x00007fff8c406b64 szone_malloc_should_clear + 1411 6 libsystem_malloc.dylib 0x00007fff8c4065a1 malloc_zone_malloc + 71 7 libsystem_malloc.dylib 0x00007fff8c4050cc malloc + 42 8 libc++.1.dylib 0x00007fff9fc2d7de operator new(unsigned long) + 30 9 jit.gl.text 0x000000013a7890c5 FTVector::expand(unsigned long) + 83 10 jit.gl.text 0x000000013a789009 FTVector::push_back(FTGlyph* const&) + 33 11 jit.gl.text 0x000000013a788c75 FTGlyphContainer::FTGlyphContainer(FTFace*) + 97 12 jit.gl.text 0x000000013a7826ad FTFontImpl::FTFontImpl(FTFont*, char const*) + 167 13 jit.gl.text 0x000000013a784ee2 FTTextureFont::FTTextureFont(char const*) + 54 14 jit.gl.text 0x000000013a783acc ftglCreateTextureFont + 34 15 jit.gl.text 0x000000013a77d6ae jit_gl_text_newftglfont + 93 16 jit.gl.text 0x000000013a77ce7f jit_gl_text_draw + 57 17 com.cycling74.MaxPlugLib 0x0000000128699354 object_method_imp + 352 18 com.cycling74.JitterAPI 0x0000000137515105 jit_ob3d_drawimmediate + 313 19 com.cycling74.MaxPlugLib 0x0000000128699354 object_method_imp + 352 20 com.cycling74.JitterAPI 0x0000000137611d3e draw_client_callback + 525 21 com.cycling74.MaxPlugLib 0x0000000128607803 linklist_funall_imp + 141 22 com.cycling74.MaxAPI 0x00000001292c2954 linklist_funall + 52 23 com.cycling74.JitterAPI 0x0000000137611a00 ob3d_client_list_iterate_safe + 36 24 com.cycling74.JitterAPI 0x000000013761091d do_draw_clients + 1120 25 com.cycling74.JitterAPI 0x000000013760e9c9 jit_gl_scenegraph_draw + 159 26 com.cycling74.MaxPlugLib 0x0000000128699354 object_method_imp + 352 27 jit.gl.render 0x00000001378221d6 jit_gl_render_draw + 117 28 jit.gl.render 0x0000000137821247 jit_gl_render_drawclients + 89 29 com.cycling74.MaxPlugLib 0x0000000128699354 object_method_imp + 352 30 com.sigabort.lmh-p2d 0x00000001382602f2 Text_Matrix::draw_text(int, int, char const*, bool, bool) + 4562 (Text_Matrix.cpp:823)
    • Aug 21 2016 | 12:02 pm
      Think I may have tracked it down. I had:
      jit_object_method( m_p_matrix, _jit_sym_setinfo, &info ); jit_object_method( m_p_matrix, _jit_sym_getdata, &m_p_rendered_text_buf ); jit_attr_setsym( m_p_render, m_p_drawto_sym, m_p_text_matrix_name );
      to change the dimension of a render but wasn't reregistering the name so I think I was accessing the old deleted object:
      jit_object_unregister( m_p_matrix ); jit_object_method( m_p_matrix, _jit_sym_setinfo, &info ); jit_object_method( m_p_matrix, _jit_sym_getdata, &m_p_rendered_text_buf ); jit_object_register( m_p_matrix, m_p_text_matrix_name ); jit_attr_setsym( m_p_render, m_p_drawto_sym, m_p_text_matrix_name );
      This seems to work without any sporadic crashes - so far....