Debugging Error: _CrtIsValidHeapPointer (pUserData)

Sometimes I get the error message "Debug Assertion Failed", which starts my Qt project in debug mode ( image ). I don’t know where I am wrong, because the compiler does not say anything, and I don’t know what to do to find my error.

I program under Windows Vista using Qt Creator 2.4.1, Qt 4.8.1.

My program should read some information from the laser device and save it in a file with code like this:

void runFunction()
{
    configure_Scanning(...);

    while(...)
    {
        // do something
        scanFunction();
        // do something
    }
}

and this is my "incriminated" function (where I think the problem is)

void scanFunction()
{
    file.open();

    data = getDataFromDevice();

    if(flag)
    {
        if(QString::compare(lineB,"")!=0)
        {
            QTextStream out(&file);
            out << lineB << endl;
            lineB = "";
        }
        lineA.append(data+"\t");
    }
    else
    {
        if(QString::compare(lineA,"")!=0)
        {
            QTextStream out(&file);
            out << lineA << endl;
            lineA = "";
        }
        lineB.prepend(data+"\t");
    }

    file.close();
}

, lineA lineB void QString: , 2D- ( -X + X , Y ). lineA (-) - (+) ; lineB (+) - (-) . , lineA ( lineB) .

, ? ?

: P

+5
1

_CrtIsValidHeapPointerUserData , , . , . , , , / . .

+10

All Articles