this includes a few upstream changes as well as a few of my own as I'm not
convinced that it should be merged into the core module yet as is done in
Qt5. the important thing is that debug builds will no longer cause assert.
upstream commits:
b184dd0a010cb7a66989
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>