In the code you provided, you are not doing any deep copy hence the crash you are getting. The QImage constructor that you are using explicitly state that you are responsible for the lifetime management of the underlying data.
'Client vertex and index arrays - all vertex array attribute and element array
index pointers must refer to buffer objects. The default vertex array object
(the name zero) is also deprecated. Calling VertexAttribPointer when no
buffer object or no vertex array object is bound will generate an INVALID_-
OPERATION error, as will calling any array drawing command when no vertex array object is bound.'
What version of Qt are you using ?
Which one gave you the warning ?
Which not ?
Are you using a custom build of Qt ?
What OS are you on ?
Version of the nVidia driver ?
Like you already found, the QtWayland module is likely what you are looking for.
If you would like to discuss things about it, one recommended channel is the #qt-labs IRC channel. You can also bring your questions on the interest mailing list You'll find there Qt's developers/maintainers. This forum is more user oriented.
By the way, shouldn't it rather be launched by your init manager (systemd, init, etc.) ?
In any case, qputenv could be used to set the environment variables and you would have to modify by hand argc and argv before passing them to your QApplication instance.
Since you are using an unreleased version of Qt and hitting something that's probably influenced by the internals of Qt. I'd recommend posting your question on the interest mailing list You'll find there Qt's developers/maintainers (this forum is more user oriented)