prefs: pass strings by reference. Also cleans up a comma in gr_modtool that made a string into a tuple (and C++ angry).
core: protect against popping a message off the queue if no handler is attached.

This mostly solves a problem with threads being launched in random
order, so a handler might not be established yet, even if there is a
message waiting. Fixes Issue #514.