Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QObject send signal twice(inside the QMetaObject::activate function ) in Qt5
Forum Updated to NodeBB v4.3 + New Features

QObject send signal twice(inside the QMetaObject::activate function ) in Qt5

Scheduled Pinned Locked Moved General and Desktop
11 Posts 4 Posters 6.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    diro
    wrote on last edited by
    #1

    I have defined a signal and connect it to a slot. I found that the slot would be invoked twice and I trace into the Qt source code.
    It seems that the QMetaObject::activate will call QAbstractDeclarativeData::signalEmitted() to relay the signal from working thread to main thread (PS. I have call setContextProperty to export my object into QML engine, so it will call the signalEmitted() function):

    @void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_index, void **argv)
    {
    int signal_index = signalOffset + local_signal_index;

    if (sender->d_func()->declarativeData && QAbstractDeclarativeData::signalEmitted)
    

    QAbstractDeclarativeData::signalEmitted(sender->d_func()->declarativeData, sender, signal_index, argv);
    @
    And the following code in the QMetaObject::activate() will also call queued_activate to cause one signal be post into message queue twice.

    @if ((c->connectionType == Qt::AutoConnection && !receiverInSameThread)
    || (c->connectionType == Qt::QueuedConnection)) {
    queued_activate(sender, signal_index, c, argv ? argv : empty_argv);
    continue;@

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tucnak
      wrote on last edited by
      #2

      Hi, ~diro!

      Have you posted about it into Bug Tracker or not?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        diro
        wrote on last edited by
        #3

        Just post it!
        "https://bugreports.qt-project.org/browse/QTBUG-26346":https://bugreports.qt-project.org/browse/QTBUG-26346

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          I you've filed a bug report please link to it here (and link to this discussion in the bug report). Thanks.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tucnak
            wrote on last edited by
            #5

            [quote author="Lukas Geyer" date="1340799948"]I you've filed a bug report please link to it here (and link to this discussion in the bug report). Thanks.[/quote]

            Lukas, can you attach URL?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #6

              The link has been already added.

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tucnak
                wrote on last edited by
                #7

                [quote author="Lukas Geyer" date="1340802271"]The link has been already added.[/quote]

                Sorry, I've missed it.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  diro
                  wrote on last edited by
                  #8

                  I checked out the newest code in git, and this bug is gone now. But I am not sure the bug is corrected in which revision.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #9

                    Please make a note of that in your bugreport. Otherwise you're going to waste developer's time on them chasing down a bug that does not exist.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      diro
                      wrote on last edited by
                      #10

                      It seems I cannot comment on that bug anymore.
                      Maybe it is due to the bug status is "Need more information" now.

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        andre
                        wrote on last edited by
                        #11

                        I'll make sure that somebody who can will, then. Thanks for trying!

                        Edit: Weird, I could comment myself, and I think you definiately should have been able to. It would be weird if you cannot actually give the information asked for because of the status "More information needed". Are you sure you were logged in?

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved