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

--- Comment #2 from Markus <markus.haberlander...@gmail.com> ---
(In reply to Sergio Martins from comment #1)
> That QList is not a pointer
> 
> It's doing axes(Qt::Horizontal).first(), not axes(Qt::Horizontal)->first()

This is of course correct, sorry for being unclear in my description. 

I was referring to the contents of the QList - the QList contains pointers to
the axes, and it is safe and intended to manipulate these via the returned
temporary QList directly.

I reported this because it just didn't make sense to me to see a warning in
this case, for the following reasons: 
* The warning is specific to the call to QList::first(), which is likely to get
called on small lists. Here it's a case where typically only one item is
returned.
* If the list contents are pointers, it's not so expensive to have a detaching
copy, nor is it so problematic since the pointers in the list are still
pointing to valid objects.
* The warning is about a "detaching-temporary". This first made me think that
"axes(..).first()" points to a temporary and not the real pointee. But this is
not the case.
* It seems to be the suggested way to use the API of QChart ...

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

Reply via email to