From 17de86f2824c1807c0fa7fa7ae0ed3b7d2acca00 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 11 Feb 2014 11:46:14 +0100 Subject: [PATCH] kms: Adapt to initialize() pattern Right now socket notifiers are attempted to be created before having the event dispatcher up. This is wrong. Change-Id: Ica3034b9fa790c037f28982db23c71342f6597d7 Reviewed-by: Andy Nichols --- src/plugins/platforms/kms/qkmsintegration.cpp | 36 +++++++++++-------- src/plugins/platforms/kms/qkmsintegration.h | 15 ++++---- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/plugins/platforms/kms/qkmsintegration.cpp b/src/plugins/platforms/kms/qkmsintegration.cpp index 63c6d08bdc..868886a0dd 100644 --- a/src/plugins/platforms/kms/qkmsintegration.cpp +++ b/src/plugins/platforms/kms/qkmsintegration.cpp @@ -66,9 +66,28 @@ QT_BEGIN_NAMESPACE QKmsIntegration::QKmsIntegration() : QPlatformIntegration(), m_fontDatabase(new QGenericUnixFontDatabase()), - m_nativeInterface(new QKmsNativeInterface) + m_nativeInterface(new QKmsNativeInterface), + m_vtHandler(0), + m_deviceDiscovery(0) { - setenv("EGL_PLATFORM", "drm",1); +} + +QKmsIntegration::~QKmsIntegration() +{ + delete m_deviceDiscovery; + foreach (QKmsDevice *device, m_devices) { + delete device; + } + foreach (QPlatformScreen *screen, m_screens) { + delete screen; + } + delete m_fontDatabase; + delete m_vtHandler; +} + +void QKmsIntegration::initialize() +{ + qputenv("EGL_PLATFORM", "drm"); m_vtHandler = new QFbVtHandler; m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_DRM | QDeviceDiscovery::Device_DRM_PrimaryGPU, 0); @@ -88,19 +107,6 @@ QKmsIntegration::QKmsIntegration() #endif } -QKmsIntegration::~QKmsIntegration() -{ - delete m_deviceDiscovery; - foreach (QKmsDevice *device, m_devices) { - delete device; - } - foreach (QPlatformScreen *screen, m_screens) { - delete screen; - } - delete m_fontDatabase; - delete m_vtHandler; -} - void QKmsIntegration::addDevice(const QString &deviceNode) { m_devices.append(new QKmsDevice(deviceNode, this)); diff --git a/src/plugins/platforms/kms/qkmsintegration.h b/src/plugins/platforms/kms/qkmsintegration.h index bba4f53d7c..3d3f1722e9 100644 --- a/src/plugins/platforms/kms/qkmsintegration.h +++ b/src/plugins/platforms/kms/qkmsintegration.h @@ -60,16 +60,17 @@ public: QKmsIntegration(); ~QKmsIntegration(); - bool hasCapability(QPlatformIntegration::Capability cap) const; + void initialize() Q_DECL_OVERRIDE; + bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; - QPlatformWindow *createPlatformWindow(QWindow *window) const; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; + QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; - QPlatformFontDatabase *fontDatabase() const; - QAbstractEventDispatcher *createEventDispatcher() const; + QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; + QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; - QPlatformNativeInterface *nativeInterface() const; + QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; void addScreen(QKmsScreen *screen); QObject *createDevice(const char *);