Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. QList<const QBluetoothDeviceInfo* declaration / definiton problem

QList<const QBluetoothDeviceInfo* declaration / definiton problem

Scheduled Pinned Locked Moved Unsolved C++ Gurus
47 Posts 6 Posters 14.5k Views
  • 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.
  • Axel SpoerlA Axel Spoerl

    But Alex insisted

    Here is what I insisted on:

    Please also post the entire code, not just fragments.

    The post contains fragments, and obviously the wrong ones.

    IN MY OPINION here is a shinning example that code posting is not of that great help

    In my opinion here is a shining example that posting wrong and incomplete code is not helpful.

    A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #17

    @Axel-Spoerl NO , YOU GOT COMPLETE WORKing CODE - after the wrong line is removed.

    Can we get back to the problem and quit bickering , it is getting tiresome.

    1 Reply Last reply
    0
    • Axel SpoerlA Online
      Axel SpoerlA Online
      Axel Spoerl
      Moderators
      wrote on last edited by
      #18

      @AnneRanch said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

      NO , YOU GOT COMPLETE WORKing CODE - after the wrong line is removed.

      Untrue. The code posted is not complete. As an example, the class definition starts with Q_OBJECT => Large parts of the declarations are missing in the first fragment.

      The second fragment misses the function name, let alone that I don't see where this unnamed function is called and where info is declared, as @JonB asked.

      @AnneRanch said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

      Can we get back to the problem

      Good idea. Please let's start with what was asked in the beginning: Please post your entire code.

      and quit bickering

      You don't have to quit bickering all at once. It's totally fine if you fade it out gradually. Or have I misunderstood, and intention was to insult me? Forgiven with a smile! Just have a look at the code of conduct when it suits you.

      it is getting tiresome.

      Kind of agree.

      Software Engineer
      The Qt Company, Oslo

      A 1 Reply Last reply
      3
      • Axel SpoerlA Axel Spoerl

        @AnneRanch said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

        NO , YOU GOT COMPLETE WORKing CODE - after the wrong line is removed.

        Untrue. The code posted is not complete. As an example, the class definition starts with Q_OBJECT => Large parts of the declarations are missing in the first fragment.

        The second fragment misses the function name, let alone that I don't see where this unnamed function is called and where info is declared, as @JonB asked.

        @AnneRanch said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

        Can we get back to the problem

        Good idea. Please let's start with what was asked in the beginning: Please post your entire code.

        and quit bickering

        You don't have to quit bickering all at once. It's totally fine if you fade it out gradually. Or have I misunderstood, and intention was to insult me? Forgiven with a smile! Just have a look at the code of conduct when it suits you.

        it is getting tiresome.

        Kind of agree.

        A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #19

        @Axel-Spoerl said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

        The second fragment misses the function name, let alone that I don't see where this unnamed function is called and where info is declared, as @JonB asked.

        What is " second fragment " ?
        The code contains two functions /methods....

        Please be more specific and make use of the requested (!) code and highlight where is " the missing function" problem.

        Since the add of info works and is verified in the code - as I repeatedly stated - the source of info is material.
        JonB is a nice guy , but this time on wrong track...

        Please quit stalling with silly requests for more code - if the code is missing a function it would not compile , duh...

        Axel SpoerlA JonBJ 2 Replies Last reply
        0
        • A Anonymous_Banned275

          @Axel-Spoerl said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

          The second fragment misses the function name, let alone that I don't see where this unnamed function is called and where info is declared, as @JonB asked.

          What is " second fragment " ?
          The code contains two functions /methods....

          Please be more specific and make use of the requested (!) code and highlight where is " the missing function" problem.

          Since the add of info works and is verified in the code - as I repeatedly stated - the source of info is material.
          JonB is a nice guy , but this time on wrong track...

          Please quit stalling with silly requests for more code - if the code is missing a function it would not compile , duh...

          Axel SpoerlA Online
          Axel SpoerlA Online
          Axel Spoerl
          Moderators
          wrote on last edited by
          #20

          @AnneRanch
          To summarize:
          @Christian Ehrlicher and @JonB, both truly nice guys, have already told you what the problem is: A pointer to a (probably) stack allocated object info is added to the list RemoteDeviceInfo. When it goes out of scope, the pointer points to a deleted object and things go banana from there. That's the most likely scenario based on the code fragments we see.

          In the next post, your call out @JonB, apparently in disagreement with the current findings.

          Very interestingly you twist things around, blaming us for not finding whatever you would accept as being the problem:

          simple reading thru should have been sufficient to find the problem.

          In essence that means:

          • you know you have a problem
          • you don't know what it is
          • you are certain that it's not, what @Christian-Ehrlicher and @JonB (very capable experts) say it is - even though they point at something obviously wrong
          • on the other hand you claim (and blame), that the code fragments posted must be sufficient for others to figure out your problem

          Question: Have you read and understood what we believe could be (part of) the problem?

          Three behaviors make it rather hard to dive deeper

          • consistently ignoring requests to post your entire code (for clarity: entire means all, everything, the whole)
          • such requests being called "silly", "bickering" (thanks by the way, it has made me laugh out loud)
          • no feedback on the findings pointed out earlier (like e.g. "Ok, thanks, I will test a different approach and let you know")

          "Simple reading thru should have been sufficient to find the problem" => I have just done as you said.
          My count is:

          • 3 refusals to co-operate
          • 2 insults
          • 1 thank you
          • 1 apology (none for the insults, though)
          • 0 please

          My finding: Communicating with you isn't fun. IMHO, communication is your problem.

          Good bye, @AnneRanch

          Software Engineer
          The Qt Company, Oslo

          1 Reply Last reply
          4
          • A Anonymous_Banned275

            @Axel-Spoerl said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

            The second fragment misses the function name, let alone that I don't see where this unnamed function is called and where info is declared, as @JonB asked.

            What is " second fragment " ?
            The code contains two functions /methods....

            Please be more specific and make use of the requested (!) code and highlight where is " the missing function" problem.

            Since the add of info works and is verified in the code - as I repeatedly stated - the source of info is material.
            JonB is a nice guy , but this time on wrong track...

            Please quit stalling with silly requests for more code - if the code is missing a function it would not compile , duh...

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #21

            @AnneRanch said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

            JonB is a nice guy , but this time on wrong track...

            Thanks. Why don't you show where info is declared since this remains the candidate for the bad behaviour from what we have seen so far?

            A 1 Reply Last reply
            3
            • JonBJ JonB

              @AnneRanch said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

              JonB is a nice guy , but this time on wrong track...

              Thanks. Why don't you show where info is declared since this remains the candidate for the bad behaviour from what we have seen so far?

              A Offline
              A Offline
              Anonymous_Banned275
              wrote on last edited by
              #22

              @JonB I have added some more debugging code , basically bypassing the range loop after the "append".

              RemoteDeviceInfo.append(&info);
              text = "DIRECT ";
              text += RemoteDeviceInfo.at(0)->name();
              qDebug()<< text;
              qDebug()<< text;
              return;

              here is the output and contents of RemoteDeviceInfo:

              " TASK START setup connect void SettingsDialog::RunPairing()"
              "\n TASK addDevice "
              " device address ED:C3:50:CA:6D:29"
              " device name OontZ Angle solo D29\n"
              " TASK pair device name OontZ Angle solo D29\n"
              " TASK pairingStatus OontZ Angle solo D292"
              "DIRECT OontZ Angle solo D29"

              or when Bluetooth "works better" - I have a real issue , outside of this problem

              " TASK continue...void SettingsDialog::RunPairing()"
              "\n TASK addDevice "
              " device address 98:D3:31:F8:39:33"
              " device name SPP-CA\n"
              " TASK pair device name SPP-CA\n"
              " TASK pairingStatus SPP-CA0"
              "DIRECT SPP-CA"
              "DIRECT SPP-CA"
              "\n TASK addDevice "
              " device address 98:D3:31:FC:10:73"
              " device name HC-05\n"
              " TASK pair device name HC-05\n"
              " TASK pairingStatus HC-050"
              "DIRECT HC-05"
              "DIRECT HC-05"
              "\n TASK addDevice "
              " device address 98:D3:31:FB:12:EB"
              " device name HC-05\n"
              " TASK pair device name HC-05\n"
              " TASK pairingStatus HC-050"
              "DIRECT HC-05"
              "DIRECT HC-05"

              This is how the other "fragment " looks now:

              void SettingsDialog::on_applyButton_11_clicked()
              {
                  text = " Direct access ";
                  text += RemoteDeviceInfo.at(0)->name();
                  qDebug()<< text;
                  return;
              
              
              

              however - this morning Bluetooth refuses to cooperate so I'll post the output of the
              void SettingsDialog::on_applyButton_11_clicked()
              later.

              Thanks for not giving up and your continuing interest in resolving this issue, appreciate that very much.
              Cheers

              JonBJ 1 Reply Last reply
              0
              • A Anonymous_Banned275

                @JonB I have added some more debugging code , basically bypassing the range loop after the "append".

                RemoteDeviceInfo.append(&info);
                text = "DIRECT ";
                text += RemoteDeviceInfo.at(0)->name();
                qDebug()<< text;
                qDebug()<< text;
                return;

                here is the output and contents of RemoteDeviceInfo:

                " TASK START setup connect void SettingsDialog::RunPairing()"
                "\n TASK addDevice "
                " device address ED:C3:50:CA:6D:29"
                " device name OontZ Angle solo D29\n"
                " TASK pair device name OontZ Angle solo D29\n"
                " TASK pairingStatus OontZ Angle solo D292"
                "DIRECT OontZ Angle solo D29"

                or when Bluetooth "works better" - I have a real issue , outside of this problem

                " TASK continue...void SettingsDialog::RunPairing()"
                "\n TASK addDevice "
                " device address 98:D3:31:F8:39:33"
                " device name SPP-CA\n"
                " TASK pair device name SPP-CA\n"
                " TASK pairingStatus SPP-CA0"
                "DIRECT SPP-CA"
                "DIRECT SPP-CA"
                "\n TASK addDevice "
                " device address 98:D3:31:FC:10:73"
                " device name HC-05\n"
                " TASK pair device name HC-05\n"
                " TASK pairingStatus HC-050"
                "DIRECT HC-05"
                "DIRECT HC-05"
                "\n TASK addDevice "
                " device address 98:D3:31:FB:12:EB"
                " device name HC-05\n"
                " TASK pair device name HC-05\n"
                " TASK pairingStatus HC-050"
                "DIRECT HC-05"
                "DIRECT HC-05"

                This is how the other "fragment " looks now:

                void SettingsDialog::on_applyButton_11_clicked()
                {
                    text = " Direct access ";
                    text += RemoteDeviceInfo.at(0)->name();
                    qDebug()<< text;
                    return;
                
                
                

                however - this morning Bluetooth refuses to cooperate so I'll post the output of the
                void SettingsDialog::on_applyButton_11_clicked()
                later.

                Thanks for not giving up and your continuing interest in resolving this issue, appreciate that very much.
                Cheers

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #23

                @AnneRanch

                • Do you still have line reading RemoteDeviceInfo.append(&info); in your code? "Yes" or "No"?
                • If "Yes" can you please, please, please, please show where info is declared?

                That's it, 2 questions, 10 seconds to answer.

                A 1 Reply Last reply
                2
                • JonBJ JonB

                  @AnneRanch

                  • Do you still have line reading RemoteDeviceInfo.append(&info); in your code? "Yes" or "No"?
                  • If "Yes" can you please, please, please, please show where info is declared?

                  That's it, 2 questions, 10 seconds to answer.

                  A Offline
                  A Offline
                  Anonymous_Banned275
                  wrote on last edited by
                  #24

                  @JonB YES
                  but sorry my class FULL CODE cannot be posted here it exceeds the allowed size.
                  You just have to take my word that "info" DOES contains data- as the debug output shows.

                  I suspect I MAY be running the class constructor multiple times....

                  Here is what I get when I attempt to debug here

                  void SettingsDialog::on_applyButton_11_clicked()
                  {
                  text = " DEBUG TEST Direct access ";
                  text += RemoteDeviceInfo.at(0)->name();
                  qDebug()<< text;
                  return; debug here

                  Screenshot from 2023-05-16 09-22-30.png

                  J.HilkJ JonBJ 2 Replies Last reply
                  0
                  • A Anonymous_Banned275

                    @JonB YES
                    but sorry my class FULL CODE cannot be posted here it exceeds the allowed size.
                    You just have to take my word that "info" DOES contains data- as the debug output shows.

                    I suspect I MAY be running the class constructor multiple times....

                    Here is what I get when I attempt to debug here

                    void SettingsDialog::on_applyButton_11_clicked()
                    {
                    text = " DEBUG TEST Direct access ";
                    text += RemoteDeviceInfo.at(0)->name();
                    qDebug()<< text;
                    return; debug here

                    Screenshot from 2023-05-16 09-22-30.png

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #25

                    @AnneRanch said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

                    I suspect I MAY be running the class constructor multiple times....

                    thats literally impossible.
                    The constructor is the only "function " that can not be called manually.

                    You may have multiple instances of a class that may or may not shadow each other, hard to tell without the full class but this error message/ debug output shows that your BluetoothDeviceInfo object is invalid/uninitialized or already destroyed.

                    Like previously suspected.


                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    A 1 Reply Last reply
                    1
                    • A Anonymous_Banned275

                      @JonB YES
                      but sorry my class FULL CODE cannot be posted here it exceeds the allowed size.
                      You just have to take my word that "info" DOES contains data- as the debug output shows.

                      I suspect I MAY be running the class constructor multiple times....

                      Here is what I get when I attempt to debug here

                      void SettingsDialog::on_applyButton_11_clicked()
                      {
                      text = " DEBUG TEST Direct access ";
                      text += RemoteDeviceInfo.at(0)->name();
                      qDebug()<< text;
                      return; debug here

                      Screenshot from 2023-05-16 09-22-30.png

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #26

                      @AnneRanch said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

                      @JonB YES
                      but sorry my class FULL CODE cannot be posted here it exceeds the allowed size.

                      So we know the code still has RemoteDeviceInfo.append(&info);, but we still can't know/be told where info is declared. As you please. I leave it to others to figure better.

                      A 1 Reply Last reply
                      1
                      • JonBJ JonB

                        @AnneRanch said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

                        @JonB YES
                        but sorry my class FULL CODE cannot be posted here it exceeds the allowed size.

                        So we know the code still has RemoteDeviceInfo.append(&info);, but we still can't know/be told where info is declared. As you please. I leave it to others to figure better.

                        A Offline
                        A Offline
                        Anonymous_Banned275
                        wrote on last edited by
                        #27

                        @JonB Would this be OK ?

                                   if(info.isValid())
                                    {
                        
                                    RemoteDeviceInfo.append(&info);
                                    text = "TEST DIRECT RemoteDeviceInfo.append(&info)";
                                    text += RemoteDeviceInfo.at(0)->name();
                                     text += RemoteDeviceInfo.at(0)->name();
                                     m_ui->plainTextEdit->appendPlainText(text);
                                    qDebug()<< text;
                                     qDebug()<< text;
                                    }
                                    else
                                    {
                                        text = "Failed info - info.isValid()";
                                        //text += RemoteDeviceInfo.at(0)->name();
                                        // text += RemoteDeviceInfo.at(0)->name();
                                        qDebug()<< text;
                                         qDebug()<< text;
                                         m_ui->plainTextEdit->appendPlainText(text);
                        
                                    }
                        
                        
                        JonBJ Axel SpoerlA 2 Replies Last reply
                        0
                        • A Anonymous_Banned275

                          @JonB Would this be OK ?

                                     if(info.isValid())
                                      {
                          
                                      RemoteDeviceInfo.append(&info);
                                      text = "TEST DIRECT RemoteDeviceInfo.append(&info)";
                                      text += RemoteDeviceInfo.at(0)->name();
                                       text += RemoteDeviceInfo.at(0)->name();
                                       m_ui->plainTextEdit->appendPlainText(text);
                                      qDebug()<< text;
                                       qDebug()<< text;
                                      }
                                      else
                                      {
                                          text = "Failed info - info.isValid()";
                                          //text += RemoteDeviceInfo.at(0)->name();
                                          // text += RemoteDeviceInfo.at(0)->name();
                                          qDebug()<< text;
                                           qDebug()<< text;
                                           m_ui->plainTextEdit->appendPlainText(text);
                          
                                      }
                          
                          
                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by JonB
                          #28

                          @AnneRanch
                          I can't tell from that from the above fragment. It depends where info is declared. If you would answer that we would know.

                          A 1 Reply Last reply
                          1
                          • A Anonymous_Banned275

                            @JonB Would this be OK ?

                                       if(info.isValid())
                                        {
                            
                                        RemoteDeviceInfo.append(&info);
                                        text = "TEST DIRECT RemoteDeviceInfo.append(&info)";
                                        text += RemoteDeviceInfo.at(0)->name();
                                         text += RemoteDeviceInfo.at(0)->name();
                                         m_ui->plainTextEdit->appendPlainText(text);
                                        qDebug()<< text;
                                         qDebug()<< text;
                                        }
                                        else
                                        {
                                            text = "Failed info - info.isValid()";
                                            //text += RemoteDeviceInfo.at(0)->name();
                                            // text += RemoteDeviceInfo.at(0)->name();
                                            qDebug()<< text;
                                             qDebug()<< text;
                                             m_ui->plainTextEdit->appendPlainText(text);
                            
                                        }
                            
                            
                            Axel SpoerlA Online
                            Axel SpoerlA Online
                            Axel Spoerl
                            Moderators
                            wrote on last edited by
                            #29

                            @AnneRanch
                            No, because isValid() is irrelevant for the error. It The crash happens in the attempt to access a deleted object. Probably it just goes out of scope after the adding function has returned. This is what everybody tries to explain, and it seems to be hard to believe for you. No matter what you try, it is wrong to store stack-allocated objects in a list member and access them outside their scope. It might even occasionally work, as long as their freed memory remains untouched. But every address sanitizer will scream out a use-after-free exception.

                            You probably assume that once it’s in the container, the object’s lifetime is bound to that container. Kind of an understandable guess: You stick candy in a box and close it. You expect it stays there. And it does, but it turns foul because it expires in the box. Boom, that’s your crash. If you ask the candy if it’s valid, it may even say yes, although it stinks already.

                            The right solution I your case is probably to allocate info on the heap with new. Change the list of objects into a list of pointers. Don’t forget to delete the heap allocated objects in the destructor, best with qDeleteAll.

                            Software Engineer
                            The Qt Company, Oslo

                            1 Reply Last reply
                            3
                            • J.HilkJ Offline
                              J.HilkJ Offline
                              J.Hilk
                              Moderators
                              wrote on last edited by
                              #30

                              I think the case is pretty clear,

                              QList<const QBluetoothDeviceInfo* > RemoteDeviceInfo; expects a heap allocated QBluetoothDeviceInfo instance

                              RemoteDeviceInfo.append(&info); info is a local function scoped stack allocated instance of QBluetoothDeviceInfo instance.

                              this is a different scoped function

                              void SettingsDialog::on_applyButton_11_clicked()
                              {
                              text = " DEBUG TEST Direct access ";
                              text += RemoteDeviceInfo.at(0)->name();
                              qDebug()<< text;
                              return;
                              

                              trying to access the now destructed info instance.

                              Very likely, but we will never know for sure.


                              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                              Q: What's that?
                              A: It's blue light.
                              Q: What does it do?
                              A: It turns blue.

                              A 2 Replies Last reply
                              2
                              • JonBJ JonB

                                @AnneRanch
                                I can't tell from that from the above fragment. It depends where info is declared. If you would answer that we would know.

                                A Offline
                                A Offline
                                Anonymous_Banned275
                                wrote on last edited by
                                #31

                                @JonB info is a result of SIGNAL - remote Bluetooth device found.

                                1 Reply Last reply
                                0
                                • J.HilkJ J.Hilk

                                  @AnneRanch said in QList<const QBluetoothDeviceInfo* declaration / definiton problem:

                                  I suspect I MAY be running the class constructor multiple times....

                                  thats literally impossible.
                                  The constructor is the only "function " that can not be called manually.

                                  You may have multiple instances of a class that may or may not shadow each other, hard to tell without the full class but this error message/ debug output shows that your BluetoothDeviceInfo object is invalid/uninitialized or already destroyed.

                                  Like previously suspected.

                                  A Offline
                                  A Offline
                                  Anonymous_Banned275
                                  wrote on last edited by
                                  #32

                                  @J-Hilk Thanks for confirming the problem.

                                  A 1 Reply Last reply
                                  0
                                  • A Anonymous_Banned275

                                    @J-Hilk Thanks for confirming the problem.

                                    A Offline
                                    A Offline
                                    Anonymous_Banned275
                                    wrote on last edited by
                                    #33

                                    @AnneRanch The crash happens in the attempt to access a deleted object. Probably it just goes out of scope after the adding function has returned. This very helpful to know.

                                    1 Reply Last reply
                                    0
                                    • J.HilkJ J.Hilk

                                      I think the case is pretty clear,

                                      QList<const QBluetoothDeviceInfo* > RemoteDeviceInfo; expects a heap allocated QBluetoothDeviceInfo instance

                                      RemoteDeviceInfo.append(&info); info is a local function scoped stack allocated instance of QBluetoothDeviceInfo instance.

                                      this is a different scoped function

                                      void SettingsDialog::on_applyButton_11_clicked()
                                      {
                                      text = " DEBUG TEST Direct access ";
                                      text += RemoteDeviceInfo.at(0)->name();
                                      qDebug()<< text;
                                      return;
                                      

                                      trying to access the now destructed info instance.

                                      Very likely, but we will never know for sure.

                                      A Offline
                                      A Offline
                                      Anonymous_Banned275
                                      wrote on last edited by
                                      #34

                                      @J-Hilk Many thanks.
                                      Finally something which makes sense.

                                      My mistake - I was just trying to make a copy of "info" for more processing AFTER the device scan is finished , not during the actual scan , which can take almost a full minute to finish.

                                      This is all I know about "info" :

                                      public slots:
                                      void addDevice(const QBluetoothDeviceInfo&);

                                      the slot processes SIGNAL deviceDiscovered

                                      connect(discoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)),
                                      this, SLOT(addDevice(QBluetoothDeviceInfo)));

                                      If the solution is to put "info" on heap - I do not know how...

                                      however if I can manage to do the desired work on received "info" , while the scan is still not finished,
                                      I may have to put it all into the slot "addDevice". Prefer not to do that.

                                      Cheers

                                      A 1 Reply Last reply
                                      0
                                      • A Anonymous_Banned275

                                        @J-Hilk Many thanks.
                                        Finally something which makes sense.

                                        My mistake - I was just trying to make a copy of "info" for more processing AFTER the device scan is finished , not during the actual scan , which can take almost a full minute to finish.

                                        This is all I know about "info" :

                                        public slots:
                                        void addDevice(const QBluetoothDeviceInfo&);

                                        the slot processes SIGNAL deviceDiscovered

                                        connect(discoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)),
                                        this, SLOT(addDevice(QBluetoothDeviceInfo)));

                                        If the solution is to put "info" on heap - I do not know how...

                                        however if I can manage to do the desired work on received "info" , while the scan is still not finished,
                                        I may have to put it all into the slot "addDevice". Prefer not to do that.

                                        Cheers

                                        A Offline
                                        A Offline
                                        Anonymous_Banned275
                                        wrote on last edited by
                                        #35

                                        @AnneRanch An idea - would this work in my application ?
                                        Little advanced for me , but if it would work I would try it.

                                        https://embeddeduse.com/2013/06/29/copied-or-not-copied-arguments-signals-slots/#:~:text=When QMetaObject%3A%3Aactivate creates the command object%2C it stores,order to make the routing of QMetaObject%3A%3Aactivate work.

                                        PS Do I understand it correctly - QT does not have "copy constructor " ?

                                        Axel SpoerlA Pl45m4P 2 Replies Last reply
                                        0
                                        • A Anonymous_Banned275

                                          @AnneRanch An idea - would this work in my application ?
                                          Little advanced for me , but if it would work I would try it.

                                          https://embeddeduse.com/2013/06/29/copied-or-not-copied-arguments-signals-slots/#:~:text=When QMetaObject%3A%3Aactivate creates the command object%2C it stores,order to make the routing of QMetaObject%3A%3Aactivate work.

                                          PS Do I understand it correctly - QT does not have "copy constructor " ?

                                          Axel SpoerlA Online
                                          Axel SpoerlA Online
                                          Axel Spoerl
                                          Moderators
                                          wrote on last edited by
                                          #36

                                          PS Do I understand it correctly - QT does not have "copy constructor " ?

                                          Goodness, no. Of course we have.

                                          Software Engineer
                                          The Qt Company, Oslo

                                          A 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