Fix BadDrawable errors when re-parenting a QGLWidget on X11/EGL
Fix BadDrawable errors when re-parenting a QGLWidget on X11/EGL

It's actually not really reparenting, but calling setWindowFlags which
triggered the errors. But setWindowFlags causes a re-parent.

The context isn't really the right please to free the surface, but
fixing that is a much more intrusive change.

Reviewed-By: TrustMe

pruiz/wkhtmltopdf-qt,pruiz/wkhtmltopdf-qt,pruiz/wkhtmltopdf-qt,igor-sfdc/qt-wk,radekp/qt,radekp/qt,radekp/qt,pruiz/wkhtmltopdf-qt,igor-sfdc/qt-wk,pruiz/wkhtmltopdf-qt,radekp/qt,igor-sfdc/qt-wk,pruiz/wkhtmltopdf-qt,igor-sfdc/qt-wk,radekp/qt,radekp/qt,igor-sfdc/qt-wk,pruiz/wkhtmltopdf-qt,igor-sfdc/qt-wk,igor-sfdc/qt-wk,pruiz/wkhtmltopdf-qt,radekp/qt,igor-sfdc/qt-wk,igor-sfdc/qt-wk,pruiz/wkhtmltopdf-qt,radekp/qt,igor-sfdc/qt-wk,pruiz/wkhtmltopdf-qt,radekp/qt,igor-sfdc/qt-wk,pruiz/wkhtmltopdf-qt,radekp/qt