Stimulus type is not M_STRING

Hi Chris,

I’ve noticed that with recently build stimuli, the Client becomes unresponsive when such a stimulus is playing.

There is a warning on the console, reappearing with every screen refresh:
20.10.11 13:56:16,258 MWClient: *** +[NSString stringWithCString:encoding:]: NULL cString

I could trace this to the EyeMonitor Plugin in Line 311 of MWPlotView.m. There the Plugin reads the type of stimulus for any announcement. Apparently, the new stimuli do not have a string Datum for “type” but are of type M_UNDEFINED (at least thats how I interpret type_data.isUndefined() returning true).

Is this intended or a bug? If intended, the EyeMonitor should be fixed by replacing line 310 of MWPlotView.m with
mw::Datum type_data = stm_announce->getElement(STIM_TYPE).getString();

I’ve had the issue with my mw_core fork and could fix it like that. Todays nightly also has the console warnings, but I didn’t apply the fix.

Thanks,
Philipp

Hi Philipp,

I’m not able to reproduce this on my workstation. Can you send me an experiment that demonstrates this behavior? Also, what specific stimulus types are you displaying when the problem manifests?

If this is happening with a custom stimulus, I’d recommend doing a clean install of the latest nightly and then recompiling your stimulus. It’s possible that the compiled versions of the core and your stimulus have fallen out of sync, leading to strange/buggy behavior.

Thanks,
Chris

Hi Chris,

you are right, it does not happen with the stimuli that come with the current nightly. It however does happen with my plugins (freshly compiled against the current nightly). It also happens with Daves’ BitCodeStimulus which I took as a template for my recent plugins.

I would highly appreciate if you could take a look at my plugin, because I can’t find any errors. As I said, the only thing that breaks is the EyeWindow, apparently because the “type” of the stimulus is M_UNDEFINED rather than M_STRING.

I am attaching the source of my most recent 3DFixationPoint project. It should compile nicely against the current nightly, but in order to run it you need to set two global parameters in the servers’ configuration: eye_to_eye_dist and eye_height, the latter may be zero.

Please feel free to modify/comment the code, especially when you feel that something (also unrelated to the problem) isn’t quite right.

Thank you!
Philipp

Attachments:

I see the problem. In DFixpointStimulus::getCurrentAnnounceDrawData, replace the following two lines

Datum announceData(M_DICTIONARY, 2);
announceData.addElement(STIM_NAME,tag);

with

Datum announceData = Stimulus::getCurrentAnnounceDrawData();
announceData.addElement(STIM_TYPE, "dfixpoint");

In the first line, Stimulus::getCurrentAnnounceDrawData sets some basic info about the stimulus (including STIM_NAME). It also fills in a generic value for STIM_TYPE, but the second line overwrites this with the specific stimulus type.

In my testing, this change eliminates the “NULL cString” messages. Hopefully, it will fix the problem for you, too. If not, please let me know.

Chris

Perfect!
I exchanged the lines and the errors are gone, this way it feels good to start off to the weekend.

Thank you!

Philipp