https://bugs.kde.org/show_bug.cgi?id=507547

--- Comment #2 from Matthias Grimrath <kdeb...@guter-grimmiger-rat.de> ---
(In reply to Mladen Milinkovic, Max from comment #1)
> I would appreciate exact message that is written - it should says something 
> like:
ASSERT: "m_ref != nullptr" in file
/home/matthias/build/subtitlecomposer-upstream/src/core/subtitleline.cpp, line
230

Build from this source:

branch 'master' of https://invent.kde.org/multimedia/subtitlecomposer

commit a5a9b4916787f3b5263945cd63840fcb8e5a43cf (HEAD -> master, origin/master,
origin/HEAD)
Author: l10n daemon script <scri...@kde.org>
Date:   Wed Jul 16 03:01:03 2025 +0000

    GIT_SILENT Sync po/docbooks with svn

> According to C++ specs?

This is the code in question:

Q_ASSERT(m_ref != nullptr);
Q_ASSERT(m_ref->m_obj == this);

const int index = m_ref - m_subtitle->m_lines.constData();

if(index < 0 || index >= m_subtitle->count()) { ...

So if 'm_ref' is NULL, 'index' contains garbage. Maybe it's not undefined by
specification - I'm no language lawyer :) - but nevertheless I think it is not
desirable. In practice though the bogus value in 'index' probably triggers the
following 'if' clause, so the still-in-place work-around code amends the
situation.

> > SOFTWARE/OS VERSIONS
> It shouldn't, but please:
> - What OS and version are you using?

Artix Linux, Arch derivative, a rolling release distribution

> - What compiler and version are you using? Is it one shipped with that 
> OS/distribution?
yes, from the distribution
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/15.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol
--enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://gitea.artixlinux.org/packages/gcc/issues
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.1.1 20250425 (GCC)

> - What Qt version are you using? Is it one shipped with that OS/distribution?
Yes, pacman says 'local/qt6-base 6.9.0-1 (qt6)'

> If the assert says:
> ASSERT: "m_ref != nullptr" in file ........./subtitleline.cpp, line 230
> your compiler is optimizing too much away and not calling object
> constructors when resizing vectors.
> 
> I saw this happen in some old Linux Mint build worker, but was unable to
> reproduce it anywhere.

In my experience C++ (not only) template semantics are very tricky. So I
wouldn't be surprised if the language spec allows that constructors in this
case here (Qt Linesmodel) may not be called as one would expect.

For this same reason (tricky semantics) I try to avoid using own non-trivial
classes with STL containers.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to