Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. [QList::operator[]: "index out of range"]
Forum Updated to NodeBB v4.3 + New Features

[QList::operator[]: "index out of range"]

Scheduled Pinned Locked Moved Solved Qt 6
5 Posts 3 Posters 798 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    appdev
    wrote on last edited by
    #1

    Hello,

    I hope you're all doing well.

    I was wondering if in my code, I have used multiple lists and when running the app, I get the error of " index out of range".. How can I know exactly which list is causing the problem.

    Running in debug mode, stops at this line: (qlist.h)

     Q_ASSERT_X(size_t(i) < size_t(d->size), "QList::operator[]", "index out of range");
            detach();
    

    But doesn't tell in which list the problem occured.

    Please help.

    Thank you all.

    JonBJ 1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Use the debugger and put a breakpoint there.

      1 Reply Last reply
      2
      • A Offline
        A Offline
        appdev
        wrote on last edited by
        #3

        @Chris-Kawa Thank youuuuu so much.

        1 Reply Last reply
        0
        • A appdev

          Hello,

          I hope you're all doing well.

          I was wondering if in my code, I have used multiple lists and when running the app, I get the error of " index out of range".. How can I know exactly which list is causing the problem.

          Running in debug mode, stops at this line: (qlist.h)

           Q_ASSERT_X(size_t(i) < size_t(d->size), "QList::operator[]", "index out of range");
                  detach();
          

          But doesn't tell in which list the problem occured.

          Please help.

          Thank you all.

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

          @appdev said in [QList::operator[]: "index out of range"]:

          But doesn't tell in which list the problem occured.

          Yes it stops at that line. But look for the stack view pane, it's one of the debugger windows. In that you will see the call stack starting from there (qlist.h) but leading back up frames to your code. That tells you where in your code it was ultimately called from.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            appdev
            wrote on last edited by
            #5

            @JonB Thank you so much :D

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved