You need specific steps to reproduce the crash with VLC or the
example program written by Sebastian Ramacher, otherwise it is
not reproducible[*]. This may also depend on the window manager
or desktop environment. The fact that you do not notice crashes
with VLC does not mean that there are no bugs.
[*]https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=807528#48
I'm copying the steps here:
To reproduce the crash:
1. Run ./helloworld
2. Move to another desktop page (my window manager: fvwm).
3. Switch off the screen and switch it on again.
4. Move to the initial desktop page. At this point, the redraw of the
helloworld window is not done (there is garbage from the previous
desktop page).
5. Click on the helloworld window. This makes the program crash.
Note: same problem with the VLC window and the same steps.