QSharedPointer and Temporary Copies
General and Desktop
4
Posts
3
Posters
2.2k
Views
1
Watching
-
Hello,
I have something like below in my code @void Fun()
{
ClassA var = queue->dequeue();
}@Now var is a qsharedpointer. From, what i could guess looking into the dequeue function of the QQueue, is that it would return a temporary copy of the var. So, it would increment by 1 the reference count for var and then decrement when it goes out of scope. Can this cause a problem ? Actually, it crashed while doing so. So, i fear, while returning temporary object, the reference counting is going wrong, the actual pointer is being deleted. It is not 100% reproducable
The architecture is ARM XScale.