Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
5.15.2
-
None
-
-
22e967c3049608f82abd32a0beb0b4b36ee134bf
Description
When I tried to use Q_COREAPP_STARTUP_FUNCTION(test_qAddPreRoutine) in the Qt platforms plugin, I found that the test_qAddPreRoutine function would be called twice.
#include <qpa/qplatformintegrationplugin.h> #include <qpa/qplatformintegration.h> #include <private/qgenericunixeventdispatcher_p.h> #include <QCoreApplication> #include <QDebug> static void test_qAddPreRoutine() { qDebug() << Q_FUNC_INFO; } Q_COREAPP_STARTUP_FUNCTION(test_qAddPreRoutine) class Test : public QPlatformIntegration { public: QPlatformBackingStore *createPlatformBackingStore(QWindow *) const override { return nullptr; } QPlatformWindow *createPlatformWindow(QWindow *window) const override { return nullptr; } QAbstractEventDispatcher *createEventDispatcher() const override { return createUnixEventDispatcher(); } }; class TestPlugin : public QPlatformIntegrationPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "test.json") public: QPlatformIntegration *create(const QString&, const QStringList&, int &, char **) override { return new Test(); } }; #include "main.moc"
If application load the “test” platform plugin, can get two lines output:
log
void test_qAddPreRoutine()
void test_qAddPreRoutine()