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

[cppcheck] Possible null pointer dereference in qqmlnotifier.cpp

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.0.0
    • None
    • qtdeclarative 16d7e13a541d479ae5278f3ef8dfb60a64f162fe

    Description

      cppcheck reports a possible null pointer dereference in qqmlnotifier.cpp. The report seems valid to me (either there is a null dereference or there is dead code).

      [./src/qml/qml/qqmlnotifier.cpp:49]: (error) Possible null pointer dereference: endpoint - otherwise it is redundant to check if endpoint is null at line 56

      Code is:

      void QQmlNotifier::emitNotify(QQmlNotifierEndpoint *endpoint)
      {
          QQmlNotifierEndpoint **oldDisconnected = endpoint->disconnected; // LINE 49
          endpoint->disconnected = &endpoint;
          endpoint->notifying = 1;
      
          if (endpoint->next)
              emitNotify(endpoint->next);
      
          if (endpoint) { // LINE 56
      
              Q_ASSERT(endpoint->callback);
              
              endpoint->callback(endpoint);
      
              if (endpoint) 
                  endpoint->disconnected = oldDisconnected;
          } 
      
          if (oldDisconnected) *oldDisconnected = endpoint;
          else if (endpoint) endpoint->notifying = 0;
      }
      

      Attachments

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

        Activity

          People

            martjone Martin Jones (closed Nokia identity) (Inactive)
            rmcgover Rohan McGovern (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes