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

Flood of timer events with started QOrientationSensor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.4.0
    • 5.2.1, 5.3.0
    • Sensors, WebKit
    • None
    • 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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            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