Hi,
I'm trying to use QSqlSocket in my application but when I delete it (manually or not), I got an exception in QSaredData line 165 :
inline ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; }
inline ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; }
To copy to clipboard, switch view to plain text mode
I just wrote a minimal code here :
here is test.h
#include <QObject>
#include <QtNetwork/QSslSocket>
{
Q_OBJECT
public:
test();
~test();
private:
QSslSocket *socket;
};
#include <QObject>
#include <QtNetwork/QSslSocket>
class test : public QObject
{
Q_OBJECT
public:
test();
~test();
private:
QSslSocket *socket;
};
To copy to clipboard, switch view to plain text mode
here is test.cpp
test::test() :
{
socket = new QSslSocket(this);
}
test::~test()
{
delete socket;
// I also try this but don't work too
// socket->deleteLater();
}
test::test() :
QObject(NULL)
{
socket = new QSslSocket(this);
}
test::~test()
{
delete socket;
// I also try this but don't work too
// socket->deleteLater();
}
To copy to clipboard, switch view to plain text mode
Here is the main program :
int main(int argc, char *argv[])
{
test t;
}
int main(int argc, char *argv[])
{
QApplication application(argc, argv);
test t;
}
To copy to clipboard, switch view to plain text mode
Can you help me please ?
Thank you
Bookmarks