I am new to programming, C++ and very new to Qt.
I am writing a multithreaded program and am having program crashes at runtime. Usually before the program crashes I am given the error "*** glibc detected *** ./blah: double free or corruption (fasttop). I believe this is because I am using a multithreaded program, and am using the update() function on the main program window from both threads, and as the threads are running as fast as possible, the update() function may be called at the same time and both threads will be trying to access the same data in the paintEvent.
I think this is fixable (in some way or another) because I am calling update() with different arguments to specify the region I want updated (there are 2 pixmaps that get painted on the same window widget next to each other). i.e in the GUI thread I am calling update(10, 10, 780, 610) and in the other thread I am calling update (810, 10, 780, 610). Do arguments to update() get passed to the PaintEvent? If so I could check what the x-coordinate argument in the update() command is from within the paint event and then use an if statement to check whether the x-coordinate corresponds to the left or right pixmap and execute their respective painting code.
This may not be the way the update() function works, and if so, could anyone suggest a better solution?
Any help would be greatly appreciated.