So I'm writing an application using qt-4.7.3 that utilizes QLocalSocket/QLocalServer, and I've found some weird behavior when building my application on different OS's.
This code:
int main(int argc, char *argv[])
{
QLocalSocket s;
// Do some stuff with our socket.
MyMainWindow w;
w.show();
}
int main(int argc, char *argv[])
{
QLocalSocket s;
// Do some stuff with our socket.
QApplication app(argc, argv);
MyMainWindow w;
w.show();
}
To copy to clipboard, switch view to plain text mode
Works as expected on Linux, but when the same code is executed on win32 it segfaults when you declare the QLocalSocket. The fix is to declare the QApplication /before/ the QLocalSocket, in which case it works fine on win32.
So basically my question is, why the different behavior, and is it possibly a bug in the QLocalSocket class? (It's also possible that I'm just doing things horribly out of order and I'm causing the issue via that.
)
Bookmarks