Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-39475

Flood of timer events with started QOrientationSensor

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.2.1, 5.3.0
    • Fix Version/s: 5.4.0
    • Component/s: Sensors, WebKit
    • Labels:
      None
    • Environment:
      Arch Linux Qt5 5.3.0-3 (also reproduced on Windows)

      Description

      After starting a QOrientationSensor, the event queue is inundated with timer events, to the point where any calls to processEvents will simply hang until the timeout.

      To compound this problem there is a QOrientationSensor created for each QWebFrame which cannot be stopped or otherwise controled. Any calls to QWebPage::mainFrame will create a QWebFrame and thus a QOrientationSensor.

      Aside from causing processEvents to freeze, this has performance and battery life implications.

      #include <QtWidgets/QApplication>
      #include <QtWebKitWidgets/QWebView>
      #include <QtSensors/QOrientationSensor>
      
      class myapp : public QApplication
      {
      public:
          myapp(int& argc, char** argv, int f = ApplicationFlags) : QApplication(argc, argv, f) {}
          virtual bool notify(QObject* o, QEvent* e)
          {
             fprintf(stderr, "%s, %d\n", o->metaObject()->className(), e->type());
                 return QApplication::notify(o, e);
          }
      };
       
      int main(int argc, char** argv)
      {
         myapp app(argc, argv);
      #if 1
         QWebView view;
         view.page()->mainFrame();
         view.show();
      #else
         QWidget w;
         QOrientationSensor *s = new QOrientationSensor;
         s->start();
         w.show();
      #endif
         app.exec();
      }
      

        Attachments

        For Gerrit Dashboard: QTBUG-39475
        # Subject Branch Project Status CR V

          Activity

            People

            • Assignee:
              allan.jensen Allan Sandfeld Jensen
              Reporter:
              olivier.jg Olivier JG
            • Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes