I'm finding a very strange situation while updating a QWidget in one of my Qt applications. What happens is that suddenly the widget's paintEvent(QEvent*) stops being called when the widget->update() method is called without any warning or command.
My application, working in Embedded Linux with Qt 4.8.5 for ARM, has two (relevant) threads: one gets data from a socket connection, fills a buffer with it and calls a slot in a distant object asking it to update the plot widget (with the update() function). The other thread is the main thread responsible for widget paintings (a rule in Qt) which execute the void paintEvent(QEvent*) function. So the sequence of events is:
- Reading thread get and identify a data pack
- Reading thread put the data inside a buffer (a QAbstractTableModel derived class)
- In the same function, reading thread emits a signal with Qt::DirectConnection to a UI base widget which has the plotting widget as its child. The receiver slot is called
slotPQDataChanged. slotPQDataChangedcalls the child widget'supdatefunction:poSubWidget->update();- In the main thread, at the moment Qt "wishes", the poSubWidget's
paintEvent(QEvent*)function is called. It has a QPainter inside which draws the received data on it.
This process happens something like 5 times per second. When I start the system, everything runs fine for some time (5-10 minutes normally), but then suddenly the update of poSubWidget stop happening. I know for certain that it's not the reading thread that stoped because, thanks to a call to qDebug(), I know that "slotPQDataChanged" continues to be called. I know as well that it's not the main thread that was killed or something like that because a timer on the screen continues to work fine when the problem happens. And I know there is no point in my code where I ask the child widget not to update when update() is called.
And, of course, I have no idea whatsoever what is happening; a (quick) research on SO returned no positive results.
It's worth mentioning that my application is probably with a bug that is making it be killed sometimes because of "out of memory".
So, any suggestions on what could be happening?