fixed: some issues pointed out by valgrind

cherry-picked from @notspiff I dropped the change in CWinEventsX11Imp::CWinEventsX11Imp from original commit.
I have seen that claimed earlier yet valgrind says otherwise. Wonder if there are version differences. Cause it sure was NULL in mine.