mirror of
https://github.com/libretro/mgba.git
synced 2024-11-24 08:30:30 +00:00
Qt: Fix DisplayGL crash
This commit is contained in:
parent
08ec1e89c4
commit
8fdfa130bd
@ -29,8 +29,11 @@ using namespace QGBA;
|
||||
|
||||
DisplayGL::DisplayGL(const QGLFormat& format, QWidget* parent)
|
||||
: Display(parent)
|
||||
, m_gl(new EmptyGLWidget(format, this))
|
||||
, m_gl(nullptr)
|
||||
{
|
||||
// This can spontaneously re-enter into this->resizeEvent before creation is done, so we
|
||||
// need to make sure it's initialized to nullptr before we assign the new object to it
|
||||
m_gl = new EmptyGLWidget(format, this);
|
||||
m_painter = new PainterGL(format.majorVersion() < 2 ? 1 : m_gl->format().majorVersion(), m_gl);
|
||||
m_gl->setMouseTracking(true);
|
||||
m_gl->setAttribute(Qt::WA_TransparentForMouseEvents); // This doesn't seem to work?
|
||||
@ -162,7 +165,9 @@ void DisplayGL::resizeEvent(QResizeEvent* event) {
|
||||
}
|
||||
|
||||
void DisplayGL::resizePainter() {
|
||||
if (m_gl) {
|
||||
m_gl->resize(size());
|
||||
}
|
||||
if (m_drawThread) {
|
||||
QMetaObject::invokeMethod(m_painter, "resize", Qt::BlockingQueuedConnection, Q_ARG(QSize, size()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user