From e191844270de265df694cda989a5c1f236b1e366 Mon Sep 17 00:00:00 2001 From: nemu Date: Wed, 27 Oct 2010 19:00:47 +0000 Subject: [PATCH] potential fix of event handler crash in non-muSR fit --- src/classes/PMusrCanvas.cpp | 6 ++++++ src/tests/eventHandler/PEventHandlerTest.cpp | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index be297072..89c1bb5c 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -3048,6 +3048,9 @@ void PMusrCanvas::PlotData(Bool_t unzoom) xmax = fXmax; } + // tell the canvas that the selected object (the one under the mouse pointer) is not your object, before to actually delete it. + fMainCanvas->SetSelected(fMainCanvas->GetPadSave()); + // cleanup if previous fMultiGraphData is present if (fMultiGraphData) { delete fMultiGraphData; @@ -3275,6 +3278,9 @@ void PMusrCanvas::PlotDifference(Bool_t unzoom) xmax = fXmax; } + // tell the canvas that the selected object (the one under the mouse pointer) is not your object, before to actually delete it. + fMainCanvas->SetSelected(fMainCanvas->GetPadSave()); + // clean up previous fMultiGraphDiff if (fMultiGraphDiff) { delete fMultiGraphDiff; diff --git a/src/tests/eventHandler/PEventHandlerTest.cpp b/src/tests/eventHandler/PEventHandlerTest.cpp index 182f269c..b790fb8d 100644 --- a/src/tests/eventHandler/PEventHandlerTest.cpp +++ b/src/tests/eventHandler/PEventHandlerTest.cpp @@ -120,6 +120,9 @@ void PEventHandlerTest::SwitchGraph() { Double_t xmin, xmax; + // tell the canvas that the selected object (the one under the mouse pointer) is not your object, before to actually delete it. + fMainCanvas->SetSelected(fMainCanvas->GetPadSave()); + if (fSwitched) { xmin = fMultiGraph1->GetXaxis()->GetBinCenter(fMultiGraph1->GetXaxis()->GetFirst()); xmax = fMultiGraph1->GetXaxis()->GetBinCenter(fMultiGraph1->GetXaxis()->GetLast());