I have a simple application that uses a qwt_plot containing a qwt_plot_picker.
I am using the plot picker to select a polygon from the plot.
Moving the mouse arround on the plot cause's a large number of page faults.
After a length of time the application ASSERTS in qpaintengine_raster.cpp 4106, this seems to be caused by not enough memory (the HDC that is being passed is NULL).
An interesting observation is that this ONLY crashes under qt 4.4.0 even though under both qt version's (there is no crash under 4.3.1) the qwt_plot_picker causes an equal number of page faults.

Bellow is the code that i am using
Regards,

Ben

Qt Code:
  1. ///GraphWidget.cpp
  2. #include "GraphWidget.hpp"
  3.  
  4. #include <qwt_legend.h>
  5. #include <qwt_plot_layout.h>
  6.  
  7.  
  8. GraphWidget::GraphWidget(QWidget *parent):
  9. QwtPlot(parent),
  10. dataPicker_(canvas())
  11. {
  12. //Setup data picker (polygon data filter)
  13. dataPicker_.setTrackerMode(QwtPicker::ActiveOnly);
  14. dataPicker_.setSelectionFlags(QwtPicker::PolygonSelection|QwtPicker::CornerToCorner);//| QwtPicker::DragSelection);//ClickSelection);
  15. dataPicker_.setRubberBand(QwtPicker::PolygonRubberBand);
  16. dataPicker_.setRubberBandPen(QPen(QColor(255, 0, 0), 1, Qt::DashLine));
  17. }
  18.  
  19. GraphWidget::~GraphWidget()
  20. {
  21.  
  22. }
  23.  
  24.  
  25.  
  26. ///GraphWidget.hpp
  27. #ifndef __GRAPHWIDGET_H__
  28. #define __GRAPHWIDGET_H__
  29.  
  30.  
  31. #include <qwt_plot.h>
  32. #include <qwt_plot_grid.h>
  33. #include <qwt_plot_curve.h>
  34. #include <qwt_plot_magnifier.h>
  35. #include <qwt_plot_panner.h>
  36. #include <qwt_symbol.h>
  37. #include <qwt_plot_zoomer.h>
  38. #include <qwt_plot_picker.h>
  39. #include <qwt_polygon.h>
  40.  
  41.  
  42. class GraphWidget : public QwtPlot
  43. {
  44. Q_OBJECT
  45.  
  46. public:
  47. GraphWidget(QWidget *parent = 0);
  48. ~GraphWidget();
  49.  
  50. private:
  51. static const int penWidth = 0.5;
  52.  
  53. private:
  54.  
  55. QwtPlotPicker dataPicker_;
  56.  
  57.  
  58. };
  59.  
  60. #endif // GRAPHWIDGET_H
  61.  
  62.  
  63. //MainWindow.cpp
  64. #include "MainWindow.hpp"
  65. #include <QFileDialog>
  66.  
  67. MainWindow::MainWindow(QWidget *parent):
  68. QMainWindow(parent)
  69. {
  70. ui_.setupUi(this);
  71. setWindowState(Qt::WindowMaximized);
  72. setCentralWidget(&graph_);
  73.  
  74. }
  75.  
  76. MainWindow::~MainWindow()
  77. {
  78.  
  79. }
  80.  
  81.  
  82. //MainWindow.hpp
  83. #ifndef __MAINWINDOW_HPP__
  84. #define __MAINWINDOW_HPP__
  85.  
  86. #include "GraphWidget.hpp"
  87.  
  88. #include <QMainWindow>
  89. #include <QButtonGroup>
  90. #include <QVector>
  91. #include <QPointF>
  92. #include <QSettings>
  93.  
  94. #include "ui_MainWindow.h"
  95.  
  96. class MainWindow : public QMainWindow
  97. {
  98. Q_OBJECT
  99.  
  100. public:
  101. MainWindow(QWidget *parent = 0);
  102. ~MainWindow();
  103.  
  104. private:
  105. Ui::MainWindowClass ui_;
  106. GraphWidget graph_;
  107.  
  108.  
  109. };
  110.  
  111. #endif // __MAINWINDOW_HPP__
  112.  
  113.  
  114. //Main.cpp
  115. #include <QMainWindow>
  116. #include <QApplication>
  117. #include <QSettings>
  118.  
  119. #include "windows.h"
  120. #include "MainWindow.hpp"
  121. void MessageHandler(QtMsgType type, const char *msg) {
  122. DWORD dw;
  123. LPVOID lpMsgBuf;
  124.  
  125. switch (type)
  126. {
  127. case QtFatalMsg:
  128. fprintf(stderr, "Fatal: %s\n", msg);
  129. dw = GetLastError();
  130. FormatMessage(
  131. FORMAT_MESSAGE_ALLOCATE_BUFFER |
  132. FORMAT_MESSAGE_FROM_SYSTEM |
  133. FORMAT_MESSAGE_IGNORE_INSERTS,
  134. NULL,
  135. dw,
  136. MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
  137. (LPTSTR) &lpMsgBuf,
  138. 0, NULL );
  139. break;
  140. }
  141. }
  142.  
  143.  
  144. int main(int argc, char** argv)
  145. {
  146. qInstallMsgHandler(MessageHandler);
  147. QApplication app(argc, argv);
  148. MainWindow mainWindow;
  149.  
  150. QCoreApplication::setOrganizationName("CEA");
  151. QCoreApplication::setOrganizationDomain("cea.com.au");
  152. QCoreApplication::setApplicationName("TVE Analysis Program");
  153. app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
  154.  
  155. mainWindow.show();
  156. return app.exec();
  157. }
To copy to clipboard, switch view to plain text mode