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());