Stimulus type is not M_STRING

pschwed's Avatar


20 Oct, 2011 12:18 PM

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.


  1. Support Staff 1 Posted by Christopher Sta... on 20 Oct, 2011 07:49 PM

    Christopher Stawarz's Avatar

    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.


  2. 2 Posted by pschwed on 21 Oct, 2011 09:06 AM

    pschwed's Avatar

    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!

  3. Support Staff 3 Posted by Christopher Sta... on 21 Oct, 2011 03:38 PM

    Christopher Stawarz's Avatar

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

    Datum announceData(M_DICTIONARY, 2);


    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.


  4. 4 Posted by pschwed on 21 Oct, 2011 05:12 PM

    pschwed's Avatar

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

    Thank you!


  5. Christopher Stawarz closed this discussion on 21 Oct, 2011 07:02 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

17 May, 2022 02:12 PM
16 May, 2022 03:12 PM
04 May, 2022 06:02 PM
03 May, 2022 01:30 PM
02 May, 2022 10:47 PM