2 ms·
It's the wrong abstraction for the use case. In the case of QML, Qt has its own memory management paradigm and you can play along or fight it. If you fight it
by projektfu 3y ago
It's the wrong abstraction for the use case. In the case of QML, Qt has its own memory management paradigm and you can play along or fight it. If you fight it, you need to know what your code and its code is doing.
I mean, why do people consider C++ to be an advanced-level language? Because it's full of these foot guns. Yet the author is a consultant who seems to work mostly with C++, so presumably they're familiar with the cargo-cult programming style of many entry-level C++ devs and the impedance mismatch between various frameworks.
It's just weird to single out smart pointers as the cause of the problem. In this case, someone made a use-after-free. Maybe it would be a memory leak done another way.
I think the Boehm GC would actually be handling this case pretty well, but C++ people are often allergic to GC, even when it would serve well.