Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug that may cause 3d viewer to crash #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions v3d_main/3drenderer/v3dr_control_signal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,20 @@ void V3dR_MainWindow::initVolumeCutRange()
{
if (! glWidget) return;

// disable the connections before initialization, otherwise may crash --ZZH 2020/3/27
if (xcmaxSlider) {
disconnect(glWidget, SIGNAL(changeXCut1(int)), xcmaxSlider, SLOT(setValue(int)));
disconnect(xcmaxSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXCut1(int)));
}
if (ycmaxSlider) {
disconnect(glWidget, SIGNAL(changeYCut1(int)), ycmaxSlider, SLOT(setValue(int)));
disconnect(ycmaxSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYCut1(int)));
}
if (zcmaxSlider) {
disconnect(glWidget, SIGNAL(changeZCut1(int)), zcmaxSlider, SLOT(setValue(int)));
disconnect(zcmaxSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZCut1(int)));
}

int d1, d2, d3;
d1 = MAX(0, glWidget->dataDim1()-1);
d2 = MAX(0, glWidget->dataDim2()-1);
Expand Down Expand Up @@ -1331,6 +1345,20 @@ void V3dR_MainWindow::initVolumeCutRange()
zCSSlider->setMaximum(d3);
zCSSlider->setValue((zCSSlider->minimum()+zCSSlider->maximum())/2);
}
// reenable the connections --ZZH 2020/3/27
if (xcmaxSlider) {
connect(glWidget, SIGNAL(changeXCut1(int)), xcmaxSlider, SLOT(setValue(int)));
connect(xcmaxSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXCut1(int)));
}
if (ycmaxSlider) {
connect(glWidget, SIGNAL(changeYCut1(int)), ycmaxSlider, SLOT(setValue(int)));
connect(ycmaxSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYCut1(int)));
}

if (zcmaxSlider) {
connect(glWidget, SIGNAL(changeZCut1(int)), zcmaxSlider, SLOT(setValue(int)));
connect(zcmaxSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZCut1(int)));
}
}

void V3dR_MainWindow::initSurfaceCutRange()
Expand Down