Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [QtSerialPort] Simple example crashes
Qt 6.12 LTS is out! See what's new in the release blog

[QtSerialPort] Simple example crashes

Scheduled Pinned Locked Moved General and Desktop
25 Posts 6 Posters 29.4k 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.
  • K Offline
    K Offline
    kuzulis
    Qt Champions 2020
    wrote on last edited by
    #12

    bq. Removed the Perl that I was using (strawberry Perl)
    Installed Active Perl (the last version)

    Hmm.. It is interesting, thx! May it is a cause of problem? Because I'm using Active perl and don't have a problem.

    Can anyone try to check with this difference of Perl?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      M4chin3
      wrote on last edited by
      #13

      IT department has to check the licences before installtion, so it might take a while. But i'll try as soon as possible.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #14

        Yesterday I didn't have tried to communicate. But I tested now and I confirm, it's working properly

        1 Reply Last reply
        0
        • M Offline
          M Offline
          M4chin3
          wrote on last edited by
          #15

          Hi everybody,

          finally i got ActivePerl installed on the Win7 machine. Sadly it didn't change anything for me :-(. I compiled and installed QtSerialPort both ways: via console and via QtCreator and tested it.

          The programm still crashes in the same behaviour as described before.

          This is the crash track in detail:
          main (QSerialPortInfo::availablePorts()) -> qserialportinfo_win.cpp;line 166 (QString s = devicePortName(deviceInfoSet, &deviceInfoData);) -> qserialportinfo_win.cpp;line 132 (QByteArray data(dataSize, 0);)

          The construction of the QByteArray fails somehow and this creates the Qt5Core.dll error. The question is why?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            M4chin3
            wrote on last edited by
            #16

            Hi,

            okay i' one step further:

            WinXP 32bit:
            Status:
            Couldn't find any serial ports but did not crash like Win7 Pro 64bit. QtSerialPort compiled with Strawberry Perl or ActivePerl didn't matter.

            Problem:
            Administrator priviliges are needed otherwise "::SetupDiEnumDeviceInfo(deviceInfoSet, index++, &deviceInfoData)" returns true but the &deviceInfoData is emtpy respectivly the device name is empty (QString s = devicePortName(deviceInfoSet, &deviceInfoData))

            I'll try to get administrator priviliges tomorrow to try this on Windows7. At least i know how the serial ports are searched on windows systems.

            Will this be changed? Otherwise users of my programm will also need administrator priviliges right? Wouldn't be that good.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kuzulis
              Qt Champions 2020
              wrote on last edited by
              #17

              @M4chin3,

              bq. The question is why?

              I don't know. For a solution I need to reproduce at itself crash - but I can't.

              bq. Otherwise users of my programm will also need administrator priviliges right?

              No. Privileges of the administrator aren't required. Most likely you have any other restrictions on your user account.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                M4chin3
                wrote on last edited by
                #18

                Hello everyone,

                in the last weeks i had no time for further investigation about the error. Today i opened the example project again, ran it and it works! I Didn't change anything in the code and my priviliges on this machine are the same than i posted the last time.

                I assume that in the time i didn't touch the project the IT department did a windows update via their updatemanagement that fixed my problem. I'll contact them for a list of updates they did in this time. I hope i get a list from them. Maybe i find a patch that could be related to my error.

                I don't have any other explanation for this.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  artem_pisarenko
                  wrote on last edited by
                  #19

                  Similar issue.

                  Using QtSerialPort built from current 'stable' branch (50ab4d) causes simple example (from wiki) to crash in first QSerialPort::open() with segmentation fault (application terminates with exit code 255). Using QtSerialPort built from current 'release' branch (84df6e) works ok.

                  My setup is:
                  Win7 Pro x64
                  Qt 4.8.4

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    artem_pisarenko
                    wrote on last edited by
                    #20

                    Bisecting between revisions I got following results:

                    • da0c6b works ok
                    • 43f7c6 seems works ok but adds messages to debug output: "virtual void QSerialPort::close(): device not open"
                    • 50ab4d causes crash (as described in previous post)

                    (Tests was performed by reusing full rebuild cycle: <module build dir> mingw32-make clean, <module build dir> mingw32-make uninstall, clean <module build dir>, clean <app project>, run qmake on <app project>, ...)

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      kuzulis
                      Qt Champions 2020
                      wrote on last edited by
                      #21

                      Hi.

                      Yes, I confirm it. Thx.

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kuzulis
                        Qt Champions 2020
                        wrote on last edited by
                        #22

                        Here a patch:

                        https://codereview.qt-project.org/#change,67801

                        please try it.

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          artem_pisarenko
                          wrote on last edited by
                          #23

                          Yes, it fixed issue.
                          (But there are still warnings since 43f7c6. Seems like QSerialPort destructor tries to do some finalizing work on already closed port.)

                          1 Reply Last reply
                          0
                          • K Offline
                            K Offline
                            kuzulis
                            Qt Champions 2020
                            wrote on last edited by
                            #24

                            (But there are still warnings since 43f7c6. Seems like QSerialPort destructor tries to do some finalizing work on already closed port.)

                            It is a not problem.

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              djszapi
                              wrote on last edited by
                              #25

                              @JBlackArty:

                              https://codereview.qt-project.org/#change,67910

                              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
                              • Unsolved