Cancel Access Violation Response Messages

I have a huge problem and I seemed to think I had solved. I have an application that uses QNetworkAccessManager. This QNAM is in the classroom. When I execute queries in this QNAM, they are all executed in a shell that contains the response and re-executes the logic on it.

For example, if I have putBlob (which inherits from baseRequest) in the constructor, I pass a link to QNAM. I execute a request on it and keep a pointer to the response. Then the response will be a child of the shell, so QNAM no longer has ownership of it. Wrappers are children of the source class that contains QNAM.

the class has a QNAM, and the child has "putBlobRequest", which has a child of "QNetworkReply *"

Now the problem is when the user wants to cancel, which should delete the main object and everything in it. Wrappers should also interrupt its QNetworkReply and disable it (so that it does not cause the finish ())

my baseRequest destructor (which contains QNetworkReply and is its parent) looks like this:

if(_reply) {
    if(_reply->isRunning()) {
        _reply->disconnect(SIGNAL(finished()));
        _reply->disconnect(SIGNAL(uploadProgress(qint64, qint64)));
        _reply->abort();
    }
}

Deletion is performed when the shell is killed in the class that holds it (right?)

This works sometimes, but sometimes I get a huge violation of access rights, and everything happens with the following call:

QtCored4.dll!QObject::disconnect(const QObject * sender, const char * signal, const QObject * receiver, const char * method)  Line 2891 + 0x8 bytes C++
QtNetworkd4.dll!QNetworkReplyImpl::abort()  Line 874 + 0x18 bytes   C++
FrameworkAzure.dll!BaseRequest::~BaseRequest()  Line 129 + 0xa bytes    C++
FrameworkAzure.dll!PutBlobRequest::~PutBlobRequest()  Line 24 + 0x5e bytes  C++
FrameworkAzure.dll!PutBlobRequest::`scalar deleting destructor'()  + 0xb bytes  C++
FrameworkAzure.dll!AzureBlobStorageProvider::~AzureBlobStorageProvider()  Line 41 + 0xa8 bytes  C++

So, abort () is called first, calling the following:

if (d->outgoingData)
    disconnect(d->outgoingData, 0, this, 0); <--- we go in here

Which takes me to line 2891 in QOBject.cpp here:

const QMetaObject *smeta = sender->metaObject(); 

where it crashes with an error:

Unhandled exception in 0x66c2c490 (QtCored4.dll) in CloudSync.exe: 0xC0000005: read access violation location 0xdddddddd.

The address "0xdddddddd" is the "sender".

? ? , !

:

:

if(_reply) {
    if(_reply->isRunning()) {
        disconnect(_reply, SIGNAL(finished()), this, SLOT(handleFinishedRequest()));
        _reply->abort();

    }
}

uploadProgress dervied putBlob. , , ""

+3

All Articles