Provide a native interface instance in minimal platform plugin
The minimal platform plugin does not have any native APIs it could offer through that interface, but needs to provide an instance anyway. A lot of code within Qt assumes that a native interface is always available and does not check the pointer value, which leads to segfaults when used with the minimal plugin. Change-Id: I625bd95afd49872cff3a34b29ceb0ffbbcd39db7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit e16f74247958329263b59fe1b9ad8bd2a25de564) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c8268beef4
commit
42d8fe6b10
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <QtGui/private/qpixmap_raster_p.h>
|
#include <QtGui/private/qpixmap_raster_p.h>
|
||||||
#include <QtGui/private/qguiapplication_p.h>
|
#include <QtGui/private/qguiapplication_p.h>
|
||||||
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
#include <qpa/qplatformwindow.h>
|
#include <qpa/qplatformwindow.h>
|
||||||
#include <qpa/qwindowsysteminterface.h>
|
#include <qpa/qwindowsysteminterface.h>
|
||||||
|
|
||||||
@ -157,6 +158,13 @@ QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPlatformNativeInterface *QMinimalIntegration::nativeInterface() const
|
||||||
|
{
|
||||||
|
if (!m_nativeInterface)
|
||||||
|
m_nativeInterface.reset(new QPlatformNativeInterface);
|
||||||
|
return m_nativeInterface.get();
|
||||||
|
}
|
||||||
|
|
||||||
QMinimalIntegration *QMinimalIntegration::instance()
|
QMinimalIntegration *QMinimalIntegration::instance()
|
||||||
{
|
{
|
||||||
return static_cast<QMinimalIntegration *>(QGuiApplicationPrivate::platformIntegration());
|
return static_cast<QMinimalIntegration *>(QGuiApplicationPrivate::platformIntegration());
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include <qpa/qplatformintegration.h>
|
#include <qpa/qplatformintegration.h>
|
||||||
#include <qpa/qplatformscreen.h>
|
#include <qpa/qplatformscreen.h>
|
||||||
|
|
||||||
|
#include <qscopedpointer.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QMinimalScreen : public QPlatformScreen
|
class QMinimalScreen : public QPlatformScreen
|
||||||
@ -46,12 +48,15 @@ public:
|
|||||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
|
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
|
||||||
QAbstractEventDispatcher *createEventDispatcher() const override;
|
QAbstractEventDispatcher *createEventDispatcher() const override;
|
||||||
|
|
||||||
|
QPlatformNativeInterface *nativeInterface() const override;
|
||||||
|
|
||||||
unsigned options() const { return m_options; }
|
unsigned options() const { return m_options; }
|
||||||
|
|
||||||
static QMinimalIntegration *instance();
|
static QMinimalIntegration *instance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable QPlatformFontDatabase *m_fontDatabase;
|
mutable QPlatformFontDatabase *m_fontDatabase;
|
||||||
|
mutable QScopedPointer<QPlatformNativeInterface> m_nativeInterface;
|
||||||
QMinimalScreen *m_primaryScreen;
|
QMinimalScreen *m_primaryScreen;
|
||||||
unsigned m_options;
|
unsigned m_options;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user