diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2011-09-19 00:11:24 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-21 16:54:45 +0200 |
commit | 405894fc39cdab937c38b917adf4e8d390f80790 (patch) | |
tree | 797a134165df57f998be73132cd614c0c0d234cb /src/plugins/platforms/directfb/qdirectfbinput.h | |
parent | acd09c21f7e3f261b584eaf9136966439eaf3a8b (diff) |
[directfb] Make QDirectFBInput a QThread to allow proper exits
Without this patch the application will get stuck waiting for the
IDFBEventBuffer to report an event. We will use the
IDFBEventBuffer::WakeUp function to interrupt the waiting but this
produces the below error on exit:
QEventLoop: Cannot be used without QApplication
QThread: Destroyed while thread is still running
This is solved by making the QDirectFBInput a QThread, reimplement
the run() method to handle the events. It should work as this is
only posting events to the QApplication event loop.
Change-Id: I24adf2b080f96c72ede6a5499f484ac33fdd44fc
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/plugins/platforms/directfb/qdirectfbinput.h')
-rw-r--r-- | src/plugins/platforms/directfb/qdirectfbinput.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h index 29300698c3..4165487840 100644 --- a/src/plugins/platforms/directfb/qdirectfbinput.h +++ b/src/plugins/platforms/directfb/qdirectfbinput.h @@ -42,8 +42,7 @@ #ifndef QDIRECTFBINPUT_H #define QDIRECTFBINPUT_H -#include <QSemaphore> -#include <QObject> +#include <QThread> #include <QHash> #include <QPoint> #include <QEvent> @@ -52,20 +51,21 @@ #include <directfb.h> -class QDirectFbInput : public QObject +class QDirectFbInput : public QThread { Q_OBJECT public: - QDirectFbInput(QObject *parent); + QDirectFbInput(); void addWindow(DFBWindowID id, QWindow *window); void removeWindow(WId wId); -public slots: - void runInputEventLoop(); void stopInputEventLoop(); - void handleEvents(); + +protected: + void run(); private: + void handleEvents(); void handleMouseEvents(const DFBEvent &event); void handleWheelEvent(const DFBEvent &event); void handleKeyEvents(const DFBEvent &event); @@ -78,8 +78,6 @@ private: IDirectFBEventBuffer *m_eventBuffer; // XXX: TODO: FIXME: leaked!!! (but it is a singleton) bool m_shouldStop; - QSemaphore m_waitStop; - QHash<DFBWindowID,QWindow *>m_tlwMap; }; |