Heap corruption after adding a QString in headerfile
I just recently got this extremely weird error that I've never gotten before. It was just before a demo and I made a small change to my code. In the code I have a QNetworkReply and I decided to start saving the response instead of just parsing it for errors (this is a baseclass and from now on, one of the derived classes needs the response from Azure to be able to do a GET method)

What I did was:

    class BaseRequest : public QObject {
    
    	Q_OBJECT
    
    protected:
    	QPointer<QNetworkReply> _reply; //responsible but not owner
    	QString _responseBody;
        ...
    }

And in the .cpp I did:

    void BaseRequest::handleFinishedRequest() {
        _responseBody = QString(_reply->readAll());

        if(_reply->error() == QNetworkReply::NoError) {
             this->handleSuccessfulRequest();
             _reply->deleteLater(); 
             return;
        }
        ...
        int action = _parser->evaluateResponse(_responseBody);
    }

This ment that I am now saving the xml that I will be getting back so that the `handleSuccessfulRequest` that will be different in every derived class can handle the responseBody if they wish. 

I then ran this app and after I few runs I got the error: 

>Windows has triggered a breakpoint in x.exe.

>This may be due to a corruption of the heap, which indicates a bug in Graphics.exe or any of the DLLs it has loaded.

>This may also be due to the user pressing F12 while x.exe has focus.

>The output window may have more diagnostic information

I have never seen this error before and it appeared about 3 more times. I then removed the change that I did and redid it. Then the issues stopped (I think) and I have no idea how to deal with this. 

After reading this question:
http://stackoverflow.com/questions/7525/of-memory-management-heap-corruption-and-c
I thought that I might have something to do with that QString, but how? Yeah, the request that it belongs to is a heap object, but not the QString directly. Could this still be the issue or is it just a coincident that the error started to appear just then? 

Also, the request that the response belongs to is as I said on the heap, but is handeled by a smart pointer (QScopedPointer which resets everytime I get a new request). I don't have any raw pointers except maybe one and I cant find any arrays that I might access with a bad index. What other reasons could it be? (I'm sorry that I cant provide more code but it's a few 1000 lines in 60 or so files and I dont know where it's crashing since I dont get a stack trace and it seems to occur randomly every time)
Heap corruption after adding a QString in headerfile
===

I just recently got this extremely weird error that I've never gotten before. It was just before a demo and I made a small change to my code. In the code I have a QNetworkReply and I decided to start saving the response instead of just parsing it for errors (this is a baseclass and from now on, one of the derived classes needs the response from Azure to be able to do a GET method)

What I did was:

    class BaseRequest : public QObject {
    
    	Q_OBJECT
    
    protected:
    	QPointer<QNetworkReply> _reply; //responsible but not owner
    	QString _responseBody;
        ...
    }

And in the .cpp I did:

    void BaseRequest::handleFinishedRequest() {
        _responseBody = QString(_reply->readAll());

        if(_reply->error() == QNetworkReply::NoError) {
             this->handleSuccessfulRequest();
             _reply->deleteLater(); 
             return;
        }
        ...
        int action = _parser->evaluateResponse(_responseBody);
    }

This ment that I am now saving the xml that I will be getting back so that the `handleSuccessfulRequest` that will be different in every derived class can handle the responseBody if they wish. 

I then ran this app and after I few runs I got the error: 

>Windows has triggered a breakpoint in x.exe.

>This may be due to a corruption of the heap, which indicates a bug in Graphics.exe or any of the DLLs it has loaded.

>This may also be due to the user pressing F12 while x.exe has focus.

>The output window may have more diagnostic information

I have never seen this error before and it appeared about 3 more times. I then removed the change that I did and redid it. Then the issues stopped (I think) and I have no idea how to deal with this. 

After reading this question:
http://stackoverflow.com/questions/7525/of-memory-management-heap-corruption-and-c
I thought that I might have something to do with that QString, but how? Yeah, the request that it belongs to is a heap object, but not the QString directly. Could this still be the issue or is it just a coincident that the error started to appear just then? 

Also, the request that the response belongs to is as I said on the heap, but is handeled by a smart pointer (QScopedPointer which resets everytime I get a new request). I don't have any raw pointers except maybe one and I cant find any arrays that I might access with a bad index. What other reasons could it be? (I'm sorry that I cant provide more code but it's a few 1000 lines in 60 or so files and I dont know where it's crashing since I dont get a stack trace and it seems to occur randomly every time)