Provide a native interface object from linuxfb
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>
Wed, 11 Feb 2015 12:32:34 +0000 (13:32 +0100)
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>
Wed, 11 Feb 2015 16:17:38 +0000 (16:17 +0000)
Recent code in font support started to use the platformNativeInterface()
return value without checking for null. Most platform plugins, with the
notable exception of linuxfb and the minimal ones, provide an object.

Start providing a dummy object from linuxfb too. This is more sensible
then adding null checks everywhere.

This will prevent crashing with linuxfb on startup.

Task-number: QTBUG-44414
Change-Id: I48912132e1f8ad52e2a94c3d765dacc7b16f309a
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
src/plugins/platforms/linuxfb/qlinuxfbintegration.h

index cb870847f2d0ef2b172fddbe19b54b35853c008d..777da98f47a8751ae01c8455c3445b349dc13cc3 100644 (file)
@@ -69,6 +69,8 @@ void QLinuxFbIntegration::initialize()
 
     m_inputContext = QPlatformInputContextFactory::create();
 
+    m_nativeInterface.reset(new QPlatformNativeInterface);
+
     m_vtHandler.reset(new QFbVtHandler);
 }
 
@@ -113,4 +115,9 @@ QPlatformServices *QLinuxFbIntegration::services() const
     return m_services.data();
 }
 
+QPlatformNativeInterface *QLinuxFbIntegration::nativeInterface() const
+{
+    return m_nativeInterface.data();
+}
+
 QT_END_NAMESPACE
index cabd943921e51f32d097af201fdcca64fa40070e..83446105f8d5878643789197810417a9bfe7ef9e 100644 (file)
@@ -35,6 +35,7 @@
 #define QLINUXFBINTEGRATION_H
 
 #include <qpa/qplatformintegration.h>
+#include <qpa/qplatformnativeinterface.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -60,6 +61,8 @@ public:
     QPlatformServices *services() const Q_DECL_OVERRIDE;
     QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE { return m_inputContext; }
 
+    QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
+
     QList<QPlatformScreen *> screens() const;
 
 private:
@@ -68,6 +71,7 @@ private:
     QScopedPointer<QPlatformFontDatabase> m_fontDb;
     QScopedPointer<QPlatformServices> m_services;
     QScopedPointer<QFbVtHandler> m_vtHandler;
+    QScopedPointer<QPlatformNativeInterface> m_nativeInterface;
 };
 
 QT_END_NAMESPACE