Qt exit code 3

  • I have a QtextEdit. To save all the characters that I insert on the edit block, I use a dynamic vector.
    It is built in the following way:

    std::vector<std::vector<symbol>> symbols

    The starting dimension is 1 for the interior vector and 1 for the exterior vector.
    symbol is a class:

    symbol(wchar_t ch, int siteId, int counter, const std::vector<int> &pos, bool verified=false);

    When I insert characters in a position that overcomes the dimension of the vector, I resize it, with the following method:

    void document::checkIndex(unsigned int i0, unsigned int i1) {
        double mult_fac=1.5;
            symbols[i0].resize((i1 + 1)*mult_fac, emptySymbol);

    The problem is that sometimes, when I continue to insert characters on my QTextEditBlock as in the following picture:
    WhatsApp Image 2020-04-16 at 10.50.43.jpeg
    my program crashed with the exit code3.
    I think that it a problem of memory allocation, but I can't solve it.

  • Lifetime Qt Champion

    @Martinuccia_96 Not sure how your question is related to Qt.
    Did you use debugger to find out where exactly it crashes?
    Please do so and post the stacktrace after crash.

Log in to reply