iem-projects / pd-mediasettings

programmatically modify the audio and MIDI settings from within Pd - secondary of https://git.iem.at/pd/mediasettings
https://git.iem.at/pd/mediasettings
Other
0 stars 0 forks source link

midisettings crashes on OSX when listing devices #1

Closed avilleret closed 5 years ago

avilleret commented 5 years ago

when sending the message [listdevices( it crashes with the following backtrace

midisettings.pd_darwin was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 3363 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2)
    frame #0: 0x00000001002eb520 midisettings.pd_darwin`midisettings_listdevices_devicelist(outlet=0x0000000100518990, type=<unavailable>, devices=0x0000000000000002, numdevs=5, maxdevs=16) at midisettings.c:361 [opt]
   358      SETFLOAT (atoms+1, (t_float)numdevs);
   359      outlet_anything(outlet, gensym("devicelist"), 2, atoms);
   360      for(i=0; i<numdevs && devices; i++, devices=devices->next) {
-> 361        if(NULL==devices->name)
   362          continue;
   363        SETSYMBOL(atoms+1, devices->name);
   364        SETFLOAT (atoms+2, (t_float)(devices->id));
Target 0: (pd) stopped.

OSX 10.13.2 / Pd 0.49-1 64Bit / mediasettings build from git commit v0.1.1-1-ge74ce36

avilleret commented 5 years ago

it appears that crash happens when using [listdevices( output to set input (or output) device. here is a minimal patcher that trigs the crash on OSX 10.13 / Pd 0.49-1

midisettings-bug.txt

umlaeute commented 5 years ago

ouch. this is basically changing the a list while iterating over it (or worse: re-creating an array while iterating over it). hrmpf.

umlaeute commented 5 years ago

to be honest, i don't haven't really been able to check whether my fix really fixes the problem. @avilleret please report if it does (not).