1. 10 Mar, 2016 - 15 commits
  2. 09 Mar, 2016 - 12 commits
    • Gabriel de Dietrich's avatar
      Wheel event widget: Harden logic an extra bit · 85a57f7a
      Gabriel de Dietrich authored
      
      This is quite an unlikely scenario, but not impossible.
      
      It could be that the wheel widget is destroyed during
      an update phase event. In that case, wheel_widget would
      be a dangling pointer for any subsequent wheel event.
      We protect against this with a QPointer.
      
      However, that would mean that if the next wheel event
      were to be an end phase event, that event would be lost.
      So we go through the usual code path, except that we won't
      set wheel_widget in the case of an end phase event.
      
      Change-Id: I59a912b845dcc249e1edc60b4dc28bf308d807d9
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@theqtcompany.com>
      85a57f7a
    • Marc Mutz's avatar
      QObject: fix GCC 6 warning about qt_static_metacall's 'hidden' attribute use · 2020d2cb
      Marc Mutz authored
      
      This warning is triggered when we try to apply the Q_DECL_HIDDEN
      attribute to a class in an unnamed namespace. Such classes are
      already not exported.
      
        qobjectdefs.h:175:108: warning: ‘visibility’ attribute ignored [-Wattributes]
        qobjectdefs.h:198:108: warning: ‘visibility’ attribute ignored [-Wattributes]
      
      Added a test on gadgets (and QObjects) in unnamed namespaces,
      because qtbase currently does not contain such Q_GADGETs.
      
      Done-with: Thiago Macieira <thiago.macieira@intel.com>
      Change-Id: Ic747cc2ab45e4dc6bb70ffff1438c747b05c5672
      Reviewed-by: default avatarLars Knoll <lars.knoll@theqtcompany.com>
      Reviewed-by: default avatarOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
      2020d2cb
    • Dyami Caliri's avatar
      Accept LFCRLF to mark end of HTTP Headers · f8f1bac3
      Dyami Caliri authored
      
      Some embedded servers use LF to mark the end of an individual header,
      but use CRLF to mark the end of all the headers. The GoPro WiFi
      interface does this, as an example.
      
      Change-Id: I227ab73622c84f439a6cf8703d020393c4d8bf69
      Reviewed-by: default avatarMarc Mutz <marc.mutz@kdab.com>
      Reviewed-by: default avatarMarkus Goetz (Woboq GmbH) <markus@woboq.com>
      f8f1bac3
    • Shawn Rutledge's avatar
      xcb: mark mouse events from tablet devices as synthesized · d7db6c6c
      Shawn Rutledge authored
      
      Task-number: QTBUG-51617
      Change-Id: Ic1d258c56165947ff821b1bf4d044bcf29b41a3b
      Reviewed-by: default avatarLaszlo Agocs <laszlo.agocs@theqtcompany.com>
      d7db6c6c
    • Friedemann Kleint's avatar
      Manual touch test: Remove QDebug operator for QTouchDevice. · d29443c9
      Friedemann Kleint authored
      
      It now exists in QtGui.
      
      Task-number: QTBUG-48849
      Change-Id: I9107c96e0010252bc50bcb02ef006cb46bd942df
      Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>
      d29443c9
    • Jarek Kobus's avatar
      Generate QVariant::fromValue(enum_value) for enum values · cb24903e
      Jarek Kobus authored
      
      Instead of just QVariant(enum_value).
      
      Task-number: QTBUG-49383
      Change-Id: Id57c65b68d4328816046bc35301dc6afba47b727
      Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>
      cb24903e
    • Friedemann Kleint's avatar
      QString::vasprintf(): Use quintptr when casting pointer for %p. · 7d374b7b
      Friedemann Kleint authored
      
      Previously, the macro Q_OS_WIN64 was checked, causing warnings:
      
      tools\qstring.cpp(6183): warning C4311: 'reinterpret_cast': pointer truncation from 'void *' to 'unsigned long'
      tools\qstring.cpp(6183): warning C4302: 'reinterpret_cast': truncation from 'void *' to 'unsigned long'
      
      when compiling WinRT/64bit, where it is not defined.
      
      Change-Id: Ib9d8405108c85170aba18b13f9c64083136bc5ee
      Reviewed-by: default avatarMaurice Kalinowski <maurice.kalinowski@theqtcompany.com>
      Reviewed-by: default avatarMarc Mutz <marc.mutz@kdab.com>
      7d374b7b
    • Marc Mutz's avatar
      tst_QMetaType: fix misleading indention · 62e89f47
      Marc Mutz authored
      
      As found by GCC 6:
      
        tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1476:9: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
               tn += ">";
               ^~
        tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1474:5: note: ...this ‘if’ clause, but it is not
           if (tn.endsWith('>'))
           ^~
      
      Fix += argument from char[2] to char as a drive-by.
      
      Change-Id: I814dc58830934cac7fcf81eb7fd7564b2abeb631
      Reviewed-by: default avatarOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
      Reviewed-by: default avatarJędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
      62e89f47
    • Marc Mutz's avatar
      QGestureManager: fix UB in filterEvent() · 3856099d
      Marc Mutz authored
      
      The code infers from the presence of an address in a
      QHash<QGesture *, ...> that the address belongs to a
      QGesture. So far that is fine enough.
      
      But in order to perform the lookup, it static_cast<>s
      the QObject* argument to a QGesture* for the QHash::
      contains() call. Even though the pointer is not
      dereferenced, the cast is UB. Says UBSan:
      
        qgesturemanager.cpp:558:73: runtime error: downcast of address 0x2ab83364f3a0 which does not point to an object of type 'QGesture'
        0x2ab83364f3a0: note: object is of type 'QDBusConnectionManager'
      
      which is a particularly hideous error message because
      of the constantly-changing completely-unrelated actual
      type in the second line of the message:
      
           52 QDBusConnectionManager
           19 QSocketNotifier
           14 QFusionStyle
           13 QAction
            6 QApplication
            3 QGraphicsWidget
            1 Window
            1 TestRunnable
            1 RectWidget
            1 QTimer
            1 QSingleShotTimer
            1 QOffscreenSurface
            1 QGraphicsProxyWidget
            1 QDefaultAnimationDriver
            1 QDBusPendingCallWatcherHelper
      
      This error is also _very_ common, triggered 116 times
      in a single run of make -C tests/auto check.
      
      Fix by using qobject_cast first and then doing the
      lookup only when the cast succeeded.
      
      Depending on the performance of qobject_cast<>, this
      may actually perform better, too.
      
      Change-Id: I884ec7d885711acc3c1d004ce93c628268d8fc18
      Reviewed-by: default avatarOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
      3856099d
    • Marc Mutz's avatar
      QString, QJson, QHash: Fix UBs involving unaligned loads · 1bfc7f68
      Marc Mutz authored
      
      Found by UBSan:
      
        src/corelib/tools/qstring.cpp:587:42: runtime error: load of misaligned address 0x2acbf4b7551b for type 'const long long int', which requires 8 byte alignment
        src/corelib/json/qjson_p.h:405:30: runtime error: store to misaligned address 0x0000019b1e52 for type 'quint64', which requires 8 byte alignment
        src/corelib/tools/qhash.cpp:116:27: runtime error: load of misaligned address 0x2b8f9ce80e85 for type 'const qlonglong', which requires 8 byte alignment
        src/corelib/tools/qhash.cpp:133:26: runtime error: load of misaligned address 0x2b8f9ce80e8d for type 'const ushort', which requires 2 byte alignment
      
      Fix by memcpy()ing into a local variable. Wrap this trick in
      template functions in qsimd_p.h. These are marked as always-
      inline and use __builtin_memcpy() where available in an
      attempt to avoid the memcpy() function call overhead in debug
      builds.
      
      While this looks prohibitively expensive, from the pov of the
      C++ abstract machine, it is 100% equivalent, except for the
      absence of undefined behavior. In one case, the cast produces
      a local temporary which is then copied into the function, and
      in the other case, that local variable comes from return value
      of qUnalignedLoad().
      
      Consequently, GCC compiles these two versions into identical
      assembler code (only verfied for ucstrncmp, but there's no
      reason to believe that it wouldn't hold for the other cases,
      too).
      
      Task-number: QTBUG-51651
      Change-Id: Ia50d4a1d7580b6f803e0895c9f3d89c7da37840c
      Reviewed-by: default avatarOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
      Reviewed-by: default avatarAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>
      1bfc7f68
    • Marc Mutz's avatar
      Q*Application: fix UB caused by accessing QGuiApplication from QCoreApplication ctor · 1b441c39
      Marc Mutz authored
      
      As reported by ubsan:
      
        src/gui/kernel/qplatformintegration.cpp:463:10: runtime error: downcast of address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication'
        0x7ffdc2942490: note: object is of type 'QCoreApplication'
      
        src/gui/kernel/qplatformintegration.cpp:466:14: runtime error: downcast of address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication'
        0x7ffdc2942490: note: object is of type 'QCoreApplication'
      
        src/gui/kernel/qplatformintegration.cpp:466:43: runtime error: member call on address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication'
        0x7ffdc2942490: note: object is of type 'QCoreApplication'
      
      to name just a few which are reported when running gui and widget
      auto-tests; there're definitely more where these came from.
      
      This is caused by QCoreApplication::init() being called from the
      QCoreApplication ctor, calling virtual functions on Q*AppPrivate,
      which happen to attempt, in this case, to emit QGuiApp signals.
      At that point in time, the QGuiApplication ctor has not entered
      the constructor body, ergo the object is still a QCoreApplication,
      and calling the signal, as a member function on the derived class,
      invokes UB.
      
      Fix by cleaning up the wild mix of initialization functions used in
      this hierarchy. The cleanup restores the
      
        1. Q*ApplicationPrivate::Q*ApplicationPrivate()
        2. Q*ApplicationPrivate::init(), calling each base class'
           init() as the first thing
      
      two-stage construction pattern commonly used elsewhere in Qt to make
      sure that the public class' object is fully constructed by the time
      each level's Private::init() is called.
      
      Change-Id: I290402b3232315d7ed687c97e740bfbdbd3ecd1a
      Reviewed-by: default avatarLars Knoll <lars.knoll@theqtcompany.com>
      1b441c39
    • Marc Mutz's avatar
      QCosmeticStroker: fix out-of-bounds access in drawPixel() · fb7ef2b9
      Marc Mutz authored
      
      Found by UBSan:
      
        src/gui/painting/qcosmeticstroker.cpp:150:55: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]'
        src/gui/painting/qcosmeticstroker.cpp:150:99: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]'
        src/gui/painting/qcosmeticstroker.cpp:151:55: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]'
      
      That code path makes no sense if no span has been populated
      yet, so skip the whole block if current_span == 0.
      
      Change-Id: I832b989e89c118dc48ab5add3a28bb44c1936a76
      Reviewed-by: default avatarAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>
      fb7ef2b9
  3. 08 Mar, 2016 - 7 commits
  4. 07 Mar, 2016 - 6 commits