Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt6Core Assert fail on array copy...
QtWS25 Last Chance

Qt6Core Assert fail on array copy...

Scheduled Pinned Locked Moved Unsolved General and Desktop
qvectorqsharedpointer
5 Posts 3 Posters 655 Views
  • 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.
  • D Offline
    D Offline
    Dariusz
    wrote on 19 Dec 2021, 02:46 last edited by Dariusz
    #1

    Hey

    Welp this is fun one.

    Im trying to copy void handleData(const QVector<QSharedPointer<myClass>>&myitems) in to a struct that gets added to a vector, like > vector.append({10,20,myItems} and I get this error :

    1993f810-4c66-4dc7-8507-6dfc8b328607-image.png

    ASSERT: "dp.freeSpaceAtEnd() >= n" in file C:\Qt\6.2.1\msvc2019_64\include\QtCore/qarraydatapointer.h, line 233

    It's save to say I have no idea what to do o.o. I never had anything like that before.

    Any1, any hints?

    TIA

    Update.
    I cant even do vector.append({10,20,{}}); o.o

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on 19 Dec 2021, 07:00 last edited by
      #2

      How is vector declared and what does the code that generates the exception actually look like?

      You debugger backtrace should tell exactly which line of your source code triggered the error.

      D 1 Reply Last reply 19 Dec 2021, 11:08
      2
      • C ChrisW67
        19 Dec 2021, 07:00

        How is vector declared and what does the code that generates the exception actually look like?

        You debugger backtrace should tell exactly which line of your source code triggered the error.

        D Offline
        D Offline
        Dariusz
        wrote on 19 Dec 2021, 11:08 last edited by Dariusz
        #3

        @ChrisW67 said in Qt6Core Assert fail on array copy...:

        How is vector declared and what does the code that generates the exception actually look like?

        You debugger backtrace should tell exactly which line of your source code triggered the error.

        Yeh, that what normally happens. This one is odd aff!

        H.

        class someObject : public QObject{
        Q_OBJECT
        struct helperData{
             int s;
             int d;
             QVector<QSharedPointer<objectX>> itemList;
        }
        QVector<helperData> mHelpers;
        

        then cpp.

        mHelpers.append(helperData{0,0,{}});
        

        And here is the error. I'm a bit like O.O

        It even happens with std::vector O.O what the heee....

        1 Reply Last reply
        0
        • D Offline
          D Offline
          Dariusz
          wrote on 19 Dec 2021, 11:39 last edited by
          #4

          Ok I found it.

          This is bananas o.o.

          Here is a rough example of what is breaking my c++, I even replaced mHelpers with QVector<int> and that was breaking too.
          Essentially I have

          public header.h : inherits baseHeader(public) class
          private headerPrivate.h : inherits baseHeaderPrivate class
          

          and I made headerPrivate :public QObject, public baseHeaderPrivate {}& Q_OBJECT macro.
          Now for some reason that has broken down my members/other objects. No idea why, maybe because I have Private in name? OR what/why? No clue. I removed QObject/Macro and vectors started to work O.O
          Seem that having it only as QObject without macro can cause it to go bananas.

          I'm working on public/private api of my own app & using QBjects where I need to. I never before used QObject on my private header tho before. So this is new and WEIRD. Any hints/ideas?
          Hmmm maybe coz my private header could use similar member/function declaration as to QT ones, I have to dig in to qt macros maybe I'm overriding some members there & causing it all to go bananas o.o

          TIA

          1 Reply Last reply
          0
          • C Online
            C Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 19 Dec 2021, 12:14 last edited by
            #5

            Provide a minimal, compilable example where it crashes - everything else is just guessing.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            0

            2/5

            19 Dec 2021, 07:00

            • Login

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