crash on mouse release when dragging 2D camera
claudeha opened this issue · 2 comments
Describe the bug
FragM segfaults when the mouse is released when dragging 2D camera.
To Reproduce
Steps to reproduce the behavior:
- Open a 2D frag.
- Drag the view with left mouse button.
- Release left mouse button.
- See error: crash
Expected behavior
No crash.
Desktop (please complete the following information):
- OS: Debian Buster
- GPU: NVIDIA G105M
- Driver: Vendor: NVIDIA Corporation / Renderer: GeForce G 105M/PCIe/SSE2 / GL Driver: 3.3.0 NVIDIA 340.108
Additional context
Seems to be DisplayWidget::setPerspective()
crashing trying to split 3D camera settings, when the camera is 2D? This patch seems to fix the crash but I haven't checked that 3D frags are unaffected with splines etc (not sure how):
diff --git a/Fragmentarium-Source/Fragmentarium/GUI/DisplayWidget.cpp b/Fragmentarium-Source/Fragmentarium/GUI/DisplayWidget.cpp
index ce901b5..cc66277 100644
--- a/Fragmentarium-Source/Fragmentarium/GUI/DisplayWidget.cpp
+++ b/Fragmentarium-Source/Fragmentarium/GUI/DisplayWidget.cpp
@@ -2551,7 +2551,8 @@ void DisplayWidget::drawLookatVector()
void DisplayWidget::setPerspective()
{
-
+ CameraControl *cc = getCameraControl();
+ if (! (cc && cc->getID() == QString("3D"))) return;
QStringList cs = mainWindow->getCameraSettings().split ( "\n" );
double fov = cs.filter ( "FOV" ).at ( 0 ).split ( "=" ).at ( 1 ).toDouble();
QStringList cv = cs.filter ( "Eye " ).at ( 0 ).split ( "=" ).at ( 1 ).split ( "," );
setPerspective() is handled... next push, you are using the most recent ?
setPerspective() is for draw3DHints(), spline path points, keyframe points and LookatVector (should be a line between current frame camera and target points, but just highlights those points as yellow)
I had moved it out of the camera3D test, haha, for testing... and forgot to put it back, oops, testing what? MMB click sets target location, CTRL+MMB click sets LightPos, it's not quite right but is adequate for setting the positions of target and light.
edit: if you test this try both DepthToAlpha ON and OFF
What I'm trying to setup for is when click and drag on light execute a shader to render XYZ orientation, moving relative to the screen plane with depth on the wheel or WASD?
...and if I can get picking to work then same thing for spline control points (keyframes) :D