[Development] Qt 5.9's new garbage collector documentation? + root_ptr

Grégoire Barbier devel at g76r.eu
Wed Jul 12 11:24:02 CEST 2017


Le 11/07/2017 à 13:49, Phil Bouchard a écrit :
> On 07/11/2017 04:02 AM, Tim Blechmann wrote:
>>> On the other hand, I have good news as I think I have found a way to
>>> simulate functions that return a function.
>>
>> how to you cope with structures like:
>>
>> function foo( outObject )
>> {
>>     var object = {}
>>     outObject.object = object
>>     outObject.result = function() { return object }
>>     return function() { return bar( object ) }
>> }
> 
> I'm looking into stuff like that so I am mimicking a run-time stack in 
> my example:
> https://github.com/philippeb8/root_ptr/blob/qt/example/javascript_example1.cpp 
> 
> 
> Meanwhile please define bar();

IMHO it become especially interesting in terms of root_ptr if bar is a 
function which:
- stores object in a global variable,
- or affect it as property values to several different QML items with 
different lifecycles,
- or even send it to C++ through a signal the slot being able of calling 
QQmlEngine::setObjectOwnership() if it wants, or add the object as a 
global variable from C++ using, for instance 
QJSEngine::globalObject().setProperty().

Regards.

-- 
Grégoire Barbier :: g à g76r.eu :: +33 6 21 35 73 49



More information about the Development mailing list