[solved] QSerialPortInfo::availablePorts() crashing on osx
-
Thanks for the links.
Turns out this may not be a Qt problem. I added a bunch of qDebugs() to try to find where the problem was and it was dying in a weird part which made me suspicious.
So I simplified the code to just a console app that repeatedly called availablePorts() and it isn't crashing.
This makes me think it was something in one of the other threads of the app. Weird that it only happens during an availablePorts() call but such is the nature of threading issues.
So back to the investigation step to try to narrow this down. At this point I'm pretty confident it isn't a Qt issue.
I'm guessing that double free that my friend found is actually ok with the release system in IOKit. It probably just ignores it as an invalid object. So no patch required.
-
Well after a ton of wasted time digging through my code and threads I decided to upgrade to 5.1.1 and the bug is gone.
Turns out it was something with Qt 5.1 and that they knew and resolved already.
Marking this as solved.
-
Better that than the other way around :)
Happy coding !
-
The bug is still there.
I've got the pretty same crash on qt 5.2.0 (vs2010 build). Trying to bind QtSerialPort to Qt gui application.
Updated: the same in console application.
Call stack:msvcr100d.dll!operator delete(void * pUserData) Line 52 + 0x51 bytes C++
QSerialPortInfo::`scalar deleting destructor'() + 0x21 bytes C++
QList<QSerialPortInfo>::node_destruct(QList<QSerialPortInfo>::Node * from, QList<QSerialPortInfo>::Node * to) Line 425 + 0x2f bytes C++
QList<QSerialPortInfo>::dealloc(QListData::Data * data) Line 779 C++
QList<QSerialPortInfo>::~QList<QSerialPortInfo>() Line 754 C++ -
Yea you're right, I had the problem again with Qt 5.2 on my mac.
What I believe is the problem was the ICU library. Since I had built Qt 5.2 from scratch whereas the Qt 5.1.1 I had used the pre-built version.
I updated my ICU library (also built from scratch) and rebuilt Qt 5.2 against that and the problem was finally resolved.
I can't guarantee that it was an ICU issue but the changing of ICU to 52 (was using 48) seems to have resolved the issue.
If your ICU library is self built I would try upgrading to 52 as well and rebuild your Qt. Alternately I haven't had a problem with this bug and the prebuilt Qt libraries so you can always use those until you can get your build issue worked out.
Sorry I never updated this thread with my new findings. :)
-
Thank you for your reply.
I haven't ever seen ICU library, which packages it could be provided with on my system? And what dependencies does it have with Qt? -
It is an internationalization package. Qt is dependent on it for QtWebKit. If you don't use or haven't compiled in QtWebKit you won't need it.
I don't think it is installed by default with windows, I could be wrong though I don't use windows much.
You can find more about it and download at:
It may not have been ICU changes that fixed my problem. It could have been the rebuild of the source. If you are using pre-compiled Qt or Qt Creator and you are seeing this problem I would look deeper in your code as it may not be the same thing I was experiencing. I never experienced this on windows or linux, only osx.
-
I read about icu and scan my system. There is no icu files or libs in my Qt sources. I don't use QtWebKit. There is no any evidence that basic example QtSerialPort application that doesn't use any additional Qt modules could crash because of one of QtWebKit dependencies.
I don't use pre-compiled Qt, I built Qt from sources using vs2010 command prompt and jom. -
@#include <QtSerialPort/QSerialPortInfo>
int main(int argc, char *argv[])
{
QSerialPortInfo::availablePorts();
}@
It's enough to crash. -
Ok, not webkit or icu then for sure.
Try getting the pre-built sources and compile and test with those. There has to be something during the build that is causing that crash. I thought mine was ICU as when I changed ICU versions and rebuilt it was "fixed". However in light of your issues maybe it was something else entirely but the rebuild fixed it anyway.
-
There is no crash in release. I't is only in debug build configuration.
-
My crash happened in both debug and release.
-
Would you please describe you system configuration at
https://bugreports.qt-project.org/browse/QTBUG-36559#comment-230605,
I submited there. -
I made further step. I avoided using than function and initialized serial port with nam string:
QSerialPortInfo info("COM25");
I began sending data from my device to computer and tried to catch it.
It worked in release but in debug there wasn't any data received. -
[quote]
I began sending data from my device to computer and tried to catch it.
It worked in release but in debug there wasn’t any data received.
[/quote]Please create other task for this issue.
Are you build library (on VS2010) yourself?
-
They find a solution - I've connected release library to project not debug one in debug mode. My fault.
-
Ok. :)
-
Well that would definitely do it lol. I would probably have though of that with the debug mode only thing if it wasn't so late last night when I was answering.
Glad you got it all working. So it probably was a bad icu lib on my build.