[Development] Question about QCoreApplicationData::*_libpaths

Mathias Hasselmann mathias at taschenorakel.de
Thu Jan 21 07:59:18 CET 2016


Am 21.01.2016 um 08:00 schrieb Marc Mutz:
> On Thursday 21 January 2016 05:24:35 Kevin Kofler wrote:
>> Marc Mutz wrote:
>>> On Wednesday 20 January 2016 22:50:43 Kevin Kofler wrote:
>>>> All these are horrible and error-prone hacks that have obvious lifetime
>>>> issues. You are complaining about Qt containers because the detaching
>>>> can invalidate iterators. Well, the lifetime issues you introduce with
>>>> the above proposed solutions are much worse! And a caching mutable
>>>> member also destroys thread-safety (in addition to the obvious lifetime
>>>> issue that the next call surprisingly invalidates your existing
>>>> reference).
>>>
>>> One word: QModelIndex.

Sorry Marc, no. Really.

QModelIndex is entirely unrelated to the problem Eike raised.

I highly reward your expertise and what you are doing for Qt, and I 
really don't want my high opinion of you being spoiled. So please grab 
fine cup of tea, take a comfortable seat and spent some time on 
understanding, why this discussion took such dramatic shift away from 
its initial topic, why you are receiving such heat. Also please take 
some time to recall what other properties but performance are important 
when designing general purpose libraries.

>> And that class is the source of innumerable bugs. The fact that one Qt
>> class has such broken semantics is no excuse for putting them everywhere.
>
> So how would you have designed it, then?

One other widespread toolkit actually has tried to implement a 
long-lived model index. This is what those guys came up with:

 
https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-row-reference-new
 
https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-new
 
https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-model-get-iter

And no, let's not follow that example. Dealing with GtkTreeModel is just 
painful. QModelIndex is perfectly fine if you use it as intended, as 
short lived reference into a tree model.


Ciao,
Mathias



More information about the Development mailing list