Skip to content
Browse files

Track thread to debug Windows 7 crash

Temporarily print out the thread ID of the thread being
used for several Qt operations, to see if that might be
the problem on Windows 7.
refs #5058
  • Loading branch information...
1 parent a4d2327 commit 7baf82545367a5dcdcb4ffdc7c53a40602db6a89 @DennisMikkelson DennisMikkelson committed Apr 23, 2012
View
8 Code/Mantid/MantidQt/ImageViewer/src/EventWSDataSource.cpp
@@ -5,6 +5,8 @@
#include <iostream>
#include <math.h>
+#include <QThread>
+
#include "MantidQtImageViewer/EventWSDataSource.h"
#include "MantidQtImageViewer/IVUtils.h"
#include "MantidAPI/ISpectrum.h"
@@ -27,6 +29,8 @@ namespace ImageView
EventWSDataSource::EventWSDataSource( IEventWorkspace_sptr ev_ws )
:ImageDataSource( 0.0, 1.0, 0.0, 1.0, 0, 0 ) // some defaults
{
+ std::cout<< "EventWSDataSource constructor on Thread " <<
+ QThread::currentThreadId() << std::endl;
this->ev_ws = ev_ws;
total_xmin = ev_ws->getTofMin();
total_xmax = ev_ws->getTofMax();
@@ -91,6 +95,8 @@ DataArray* EventWSDataSource::GetDataArray( double xmin, double xmax,
size_t n_rows, size_t n_cols,
bool is_log_x )
{
+ std::cout<< "EventWSDataSource GetDataArray on Thread " <<
+ QThread::currentThreadId() << std::endl;
/*
std::cout << "Start EventWSDataSource::GetDataArray " << std::endl;
std::cout << " xmin = " << xmin
@@ -176,6 +182,8 @@ void EventWSDataSource::GetInfoList( double x,
double y,
std::vector<std::string> &list )
{
+ std::cout<< "EventWSDataSource::GetInfoList on Thread " <<
+ QThread::currentThreadId() << std::endl;
list.clear();
list.push_back("Test X:");
View
2 Code/Mantid/MantidQt/ImageViewer/src/EventWSImageView.cpp
@@ -8,6 +8,8 @@ using namespace ImageView;
EventWSImageView::EventWSImageView( IEventWorkspace_sptr ev_ws )
{
+ std::cout<< "EventWSImageView constructor on Thread " <<
+ QThread::currentThreadId() << std::endl;
EventWSDataSource* source = new EventWSDataSource( ev_ws );
image_view = new ImageView( source );
}
View
12 Code/Mantid/MantidQt/ImageViewer/src/GraphDisplay.cpp
@@ -1,3 +1,5 @@
+
+#include <iostream>
#include <QtGui>
#include <QVector>
#include <QString>
@@ -25,6 +27,8 @@ GraphDisplay::GraphDisplay( QwtPlot* graph_plot,
QTableWidget* graph_table,
bool is_vertical )
{
+ std::cout<< "GraphDisplay constructor on Thread " <<
+ QThread::currentThreadId() << std::endl;
this->graph_plot = graph_plot;
this->graph_table = graph_table;
this->data_source = 0;
@@ -57,6 +61,8 @@ GraphDisplay::~GraphDisplay()
*/
void GraphDisplay::SetDataSource( ImageDataSource* data_source )
{
+ std::cout<< "GraphDisplay SetDataSource on Thread " <<
+ QThread::currentThreadId() << std::endl;
this->data_source = data_source;
}
@@ -80,6 +86,8 @@ void GraphDisplay::SetData(const QVector<double> & xData,
double image_x,
double image_y )
{
+ std::cout<< "GraphDisplay SetData on Thread " <<
+ QThread::currentThreadId() << std::endl;
if ( xData.size() == 0 || // ignore invalid data vectors
yData.size() == 0 ||
xData.size() != yData.size() )
@@ -131,6 +139,8 @@ void GraphDisplay::SetData(const QVector<double> & xData,
*/
void GraphDisplay::SetPointedAtPoint( QPoint point )
{
+ std::cout<< "GraphDisplay SetPointedAtPoint on Thread " <<
+ QThread::currentThreadId() << std::endl;
double x = graph_plot->invTransform( QwtPlot::xBottom, point.x() );
double y = graph_plot->invTransform( QwtPlot::yLeft, point.y() );
ShowInfoList( x, y );
@@ -149,6 +159,8 @@ void GraphDisplay::SetPointedAtPoint( QPoint point )
*/
void GraphDisplay::ShowInfoList( double x, double y )
{
+ std::cout<< "GraphDisplay ShowInfoList on Thread " <<
+ QThread::currentThreadId() << std::endl;
int n_infos = 0;
int n_rows = 2;
std::vector<std::string> info_list;
View
11 Code/Mantid/MantidQt/ImageViewer/src/IVConnections.cpp
@@ -31,6 +31,8 @@ IVConnections::IVConnections( Ui_MainWindow* ui,
GraphDisplay* h_graph_display,
GraphDisplay* v_graph_display )
{
+ std::cout<< "IVConnections constructor on Thread " <<
+ QThread::currentThreadId() << std::endl;
iv_ui = ui;
this->image_display = image_display;
this->h_graph_display = h_graph_display;
@@ -223,6 +225,9 @@ void IVConnections::somethingChanged()
void IVConnections::toggle_Hscroll()
{
+ std::cout<< "IVConnections toggle_Hscroll on Thread " <<
+ QThread::currentThreadId() << std::endl;
+
bool is_on = iv_ui->action_Hscroll->isChecked();
iv_ui->imageHorizontalScrollBar->setVisible( is_on );
iv_ui->imageHorizontalScrollBar->setEnabled( is_on );
@@ -241,6 +246,9 @@ void IVConnections::toggle_Vscroll()
void IVConnections::v_scroll_bar_moved()
{
+ std::cout<< "IVConnections v_scroll_bar_moved on Thread " <<
+ QThread::currentThreadId() << std::endl;
+
image_display->UpdateImage();
}
@@ -253,6 +261,9 @@ void IVConnections::h_scroll_bar_moved()
void IVConnections::imageSplitter_moved()
{
+ std::cout<< "IVConnections imageSplitter_moved on Thread " <<
+ QThread::currentThreadId() << std::endl;
+
QList<int> sizes = iv_ui->imageSplitter->sizes();
QList<int> vgraph_sizes;
vgraph_sizes.append( sizes[0] );
View
8 Code/Mantid/MantidQt/ImageViewer/src/ImageDisplay.cpp
@@ -37,6 +37,8 @@ ImageDisplay::ImageDisplay( QwtPlot* image_plot,
GraphDisplay* v_graph,
QTableWidget* table_widget )
{
+ std::cout<< "ImageDisplay constructor on Thread " <<
+ QThread::currentThreadId() << std::endl;
ColorMaps::getColorMap( ColorMaps::HEAT,
256,
color_table );
@@ -77,6 +79,8 @@ ImageDisplay::~ImageDisplay()
*/
void ImageDisplay::SetDataSource( ImageDataSource* data_source )
{
+ std::cout<< "ImageDisplay SetDataSource on Thread " <<
+ QThread::currentThreadId() << std::endl;
this->data_source = data_source;
h_graph_display->SetDataSource( data_source );
v_graph_display->SetDataSource( data_source );
@@ -115,6 +119,8 @@ void ImageDisplay::SetDataSource( ImageDataSource* data_source )
*/
void ImageDisplay::UpdateImage()
{
+ std::cout<< "ImageDisplay UpdateImage on Thread " <<
+ QThread::currentThreadId() << std::endl;
if ( data_source == 0 || data_array == 0 )
{
return; // no image data to update
@@ -246,6 +252,8 @@ void ImageDisplay::SetIntensity( double control_parameter )
*/
void ImageDisplay::SetPointedAtPoint( QPoint point )
{
+ std::cout<< "ImageDisplay SetPointedAtPoint on Thread " <<
+ QThread::currentThreadId() << std::endl;
double x = image_plot->invTransform( QwtPlot::xBottom, point.x() );
double y = image_plot->invTransform( QwtPlot::yLeft, point.y() );
View
6 Code/Mantid/MantidQt/ImageViewer/src/ImagePlotItem.cpp
@@ -1,6 +1,6 @@
#include <iostream>
-
+#include <QThread>
#include "MantidQtImageViewer/ImagePlotItem.h"
namespace MantidQt
@@ -32,6 +32,8 @@ ImagePlotItem::ImagePlotItem()
void ImagePlotItem::SetData( DataArray* data_array,
std::vector<QRgb>* color_table )
{
+ std::cout<< "PlotItem SetData on Thread " <<
+ QThread::currentThreadId() << std::endl;
this->data_array = data_array;
this->color_table = color_table;
}
@@ -71,6 +73,8 @@ void ImagePlotItem::draw( QPainter * painter,
const QwtScaleMap & yMap,
const QRect & ) const
{
+ std::cout<< "PlotItem draw on Thread " <<
+ QThread::currentThreadId() << std::endl;
//std::cout << "ImagePlotItem::draw called =====================" << std::endl;
if ( data_array && color_table ) // if data not yet set, just return

0 comments on commit 7baf825

Please sign in to comment.
Something went wrong with that request. Please try again.