Using QByteRef with an index pointing outside the valid range of a QByteArray. The corresponding behavior is deprecated, and will be changed in a future version of Qt.
Closed this issue · 2 comments
Hi,
I am experiencing this warning continuously:Using QByteRef with an index pointing outside the valid range of a QByteArray. The corresponding behavior is deprecated, and will be changed in a future version of Qt
It comes from the dynamic initialization of the QByteArray
. especially in serialWorker.cpp
I have tested applying qbytearray.resize({fixed allocation size})'
But I ha been unsuccessful for now in getting rid of all of them...
I believe I have figured it out, finally...
Basically, the SerialWorker calls the Frameprocessor class when data is ready to send a pointer with the Frame that it has just read from the Serial. If more frames are received while the last frame is still being processed in the frameprocessor the SreialWorker then will clear and rewrite the frame before the frameProcessor has finished with it... That causes a lot of trouble!
So I think the solution is to use a new instance of the Frame class every time the SerialWorker reads from the serial m_inFrame = new Frame();
instead of clearing it. And then, to avoid memory leaks (not sure if this is the right approach) call frame->deleteLater();
before exiting the FrameIncomming method
I would submit some PR... but I don't know your involvement with the evolution of the repo so I just leave it here so it's useful to someone. For now, live progress can be found in here.