https://bugs.kde.org/show_bug.cgi?id=507547
--- Comment #8 from Matthias Grimrath <[email protected]> --- I added some additional debug output (see attached patch) which reveals what triggers the assertion on my computer. The 'ObjectRef<>' class checks wether the pointer points inside the QVector<> array, and if not, leaves 'm_ref' at its NULL value. So added I some code to print the pointer values if a call to 'ref()' or 'movref()' skips assigning to 'm_ref' because of that. this=0x555555f500b0 beg=0x555555f500c0 end=0x555555f502b0 cap=31 len=9 this=0x555555f500b0 m_obj=0x555559314e80 ignoring ASSERT: "m_ref != nullptr" in file /home/matthias/build/subtitlecomposer-upstream/src/core/subtitleline.cpp, line 230 What is odd is that the 'this' value (0x555555f500b0) is exactly one element before the beginning of the QVector<> array (0x555555f500c0). So 'm_ref' is left at its NULL value, although it suspiciously looks like it should be a member of the 'QVector<>' object. If a set a breakpoint at the code where it decides not to set 'm_ref' (gdb) b ObjectRef<SubtitleComposer::SubtitleLine>::inContainerXXX() I get this backtrace: (gdb) bt #0 SubtitleComposer::ObjectRef<SubtitleComposer::SubtitleLine>::inContainerXXX (this=this@entry=0x7fffffffb4c0) at /home/matthias/build/subtitlecomposer-upstream/src/helpers/objectref.h:82 #1 0x00005555555c5e0a in SubtitleComposer::ObjectRef<SubtitleComposer::SubtitleLine>::moveref (this=this@entry=0x7fffffffb4c0, other=other@entry=0x7fffffffb580) at /home/matthias/build/subtitlecomposer-upstream/src/helpers/objectref.h:62 #2 0x0000555555615df8 in SubtitleComposer::ObjectRef<SubtitleComposer::SubtitleLine>::ObjectRef (this=0x7fffffffb4c0, other=...) at /home/matthias/build/subtitlecomposer-upstream/src/helpers/objectref.h:35 #3 QtPrivate::QGenericArrayOps<SubtitleComposer::ObjectRef<SubtitleComposer::SubtitleLine> >::emplace<SubtitleComposer::ObjectRef<SubtitleComposer::SubtitleLine> > (this=this@entry=0x5555561fc090, i=i@entry=0) at /usr/include/qt6/QtCore/qarraydataops.h:545 The code at qarraydataops.h:545 reveals what happens here: if (growsAtBegin) { Q_ASSERT(this->freeSpaceAtBegin()); new (this->begin() - 1) T(std::move(tmp)); --this->ptr; ++this->size; } else { So QVector<> *does* call the constructor of ObjectRef<>, but it hasn't updated its internal pointers yet. So when 'inContainer()' checks the pointer, it gets outdated values from the QVector<> object and thus wrongly assumes the 'SubtitleLine' pointer is outside the array. -- You are receiving this mail because: You are watching all bug changes.
