-
Hi,
I'm running into a weird behavior when dispatching the run() function of a class that inherits from QRunnable. The class in question has 2 member variables that are dynamically allocated in its constructor:
float *mBufferX = new float[mBufferXSize.toInt()]; float *mBufferY = new float[mBufferYSize.toInt()];
Now, whenever the run() function is invoked, these 2 variables are NULL. However, the object exist and thus its constructor was called. How is it that these variables are NULL?
Thank you very much!
-
Hi,
I'm running into a weird behavior when dispatching the run() function of a class that inherits from QRunnable. The class in question has 2 member variables that are dynamically allocated in its constructor:
float *mBufferX = new float[mBufferXSize.toInt()]; float *mBufferY = new float[mBufferYSize.toInt()];
Now, whenever the run() function is invoked, these 2 variables are NULL. However, the object exist and thus its constructor was called. How is it that these variables are NULL?
Thank you very much!
Assuming you posted exactly what you wrote in your constructor, you shadow the members with the local variables.
https://en.wikipedia.org/wiki/Variable_shadowing#C++