PDA

View Full Version : pure virtual Runtime Error in qwt_plot_curve.cpp



FuNkDaDdY
19th November 2011, 11:10
Hi guys, I'm using 4.7.0 and qwt 6.0.1 with vs 2008 (note problem also happens on vs 2010 or with qwt 6.0.0). I'm basically drawing a sine graph with my own class that extends qwtplot. Theres a producer class creating the sine data in its own thread and the gui thread renders it at a set replot() rate. After a few arbritrary seconds (not at the same time on each run) vs aborts with:

R6025 -pure virtual function call

with the call stack always breaking out at

double x = xMap.transform( sample.x() );

in qwt_plot_curve.cpp (line 397)

I have no idea whats going on. Any ideas?

Spitfire
22nd November 2011, 09:16
How do you set the data on the curve?
Is the data you set available during the life of the curve object?

My guess would be that you're discarding the data while curve want's to access it.
From documentation:
Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve.

setRawSamples is provided for efficiency. It is important to keep the pointers during the lifetime of the underlying QwtCPointerData class.

FuNkDaDdY
26th November 2011, 04:52
I've solved this. The data was not being discarded and was correctly accessed using boost mutexes (the producer thread is a boost thread). I was able to resolve the issue by using the boost thread to trigger qt events rather than running qt code on a boost thread. It appears that in some cases boost threads and qt threads don't play nice together.