fixed: some issues pointed out by valgrind

cherry-picked from @notspiff I dropped the change in CWinEventsX11Imp::CWinEventsX11Imp from original commit.
Value() is never NULL.