Cycling74 / min-api

High-level C++-language application programming interface for Max
MIT License
57 stars 23 forks source link

Min API externals receive zero length args from certain sources if not declared threadsafe #185

Open rtu-ableton opened 2 years ago

rtu-ableton commented 2 years ago

If an external is created with the Min API, some sources connected to the inlet work (e.g. a message box, UI element) and others don't (e.g. midi messages coming from midiin).

In this example code, a list of length 2 from midiin will trigger the error:

message<> test{
    this, "test", "test input", [this](const atoms& args, int inlet) -> atoms {
      (void)inlet;

      if (args.size() < 1)
      {
        cerr << "bad list length, size = " << args.size() << endl;
        return {};
      }

The problem goes away if the message is declared threadsafe via message<threadsafe::yes> but either this should not be necessary, or a meaningful error should be displayed somehow to help the dev.

robtherich commented 2 years ago

hi @rtu-ableton we are trying to understand the report. are you suggesting that all message in min should be threadsafe by default?