Ticket #11025 (closed: fixed)
plotSlice (python CLI) makes mantid crash badly if input is a peaks workspace
Reported by: | Federico M Pouzols | Owned by: | Federico M Pouzols |
---|---|---|---|
Priority: | major | Milestone: | Release 3.4 |
Component: | Python | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Harry Jeffery |
Description
Use it for example on TrainingCourseData/peaks_qLab.nxs:
foo=Load('peaks_qLab.nxs', OutputWorkspace='foo_name') plotSlice('foo_name')
and you'll get a segfault.
plotSlice(foo)
also crashes MantidPlot.
For all other types of workspaces (2D, event, MD) it seems to behave well. I think that this is very closely related to other issues in different plot... functions that were fixed in #8419, but plotSlice was not considered there.
Change History
comment:2 Changed 6 years ago by Federico Montesino Pouzols
- Status changed from assigned to inprogress
better input checks for plotSlice, re #11025
Changeset: af494465bb2fdf7e4aa3698d388ea878262011dc
comment:3 Changed 6 years ago by Federico M Pouzols
- Status changed from inprogress to verify
- Resolution set to fixed
This is being verified as pull request #316.
comment:4 Changed 6 years ago by Harry Jeffery
- Status changed from verify to verifying
- Tester set to Harry Jeffery
comment:6 Changed 6 years ago by Harry Jeffery
Your fix works nicely on my system, but it doesn't actually solve the crash itself within Mantid. I'd like to see the crash itself fixed before I could call this done.
Here's a patch to fix the crash itself: `patch From efab20f9e14d021a4b87dbaa5144f668fa0bdc18 Mon Sep 17 00:00:00 2001 From: Harry Jeffery <henry.jeffery@…> Date: Fri, 27 Feb 2015 13:34:27 +0000 Subject: Refs #11025 Fix crash in LineViewer::setWorkspace() ---
Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp b/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp index 73fec22..0be3451 100644 --- a/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp +++ b/Code/Mantid/MantidQt/SliceViewer/src/LineViewer.cpp @@ -654,10 +654,12 @@ bool LineViewer::getFixedBinWidthMode() const
/ Set the workspace being sliced
*
- @param ws :: IMDWorkspace */
void LineViewer::setWorkspace(Mantid::API::IMDWorkspace_sptr ws) {
+ if(!ws) + throw std::runtime_error("LineViewer::setWorkspace(): Invalid workspace.");
m_ws = ws; m_thickness = VMD(ws->getNumDims()); createDimensionWidgets(); Update the dimensions shown in the original workspace m_lineOptions->setOriginalWorkspace(m_ws);
-- 2.3.0
`
If you save that to a file such as fix-lineviewer-crash.patch, you can apply it to your branch with git am fix-lineviewer-crash.patch
comment:7 Changed 6 years ago by Harry Jeffery
Refs #11025 Fix crash in LineViewer::setWorkspace()
Changeset: 2e7e9a19602ec46b4b167d3ccb1f777982df35e2
comment:8 Changed 6 years ago by Federico M Pouzols
Cool, this should make it bomb proof. I just applied your patch, @eXeC64 .
comment:9 Changed 6 years ago by Harry Jeffery
- Status changed from verifying to closed
Merge pull request #316 from mantidproject/11025_plotSlice_crashes_on_peaks_ws
plotSlice on wrong workspace types: prevent crash and give informative error message
Full changeset: 8e8ab9dfa0b5502a59d614f219382880d5d63448
comment:10 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 11864