-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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 Bug between addText3D and QVTKWidget #5054
Conversation
When using addtext3d to display 3D text in qvtkwidget, an error "access conflict occurs when reading position 0x000000000000008" will be reported. The reason is that "render - > render()" has been used in addtext3d once, but to send 3D text to qvtkwidget window, execute "UI - > qvtkwidget - > setrenderwindow (viewer - > getrenderwindow());Viewer - > setupinteractor (UI - > qvtkwidget - > getinteractor()); ", which is equivalent to repeated rendering, resulting in pointer out of bounds. After experiments, it is OK to delete "render - > render()" and it works normally when it does not interact with qvtkwidget
Instead of commenting the line, just remove it. Which version of VTK have you tested with? I can reproduce it with VTK 9.0.1, so unless you have tested VTK 6,7,8 I'd suggest to wrap it in:
|
|
I have tested with vtk8.0.0, but vtk6 and 7 have not been tested |
Eventually someone could test it on linux, but for now, since its the only place its called, I'll be fine with just removing it. |
FYI. You can just commit to your branch and push it again with new changes - you don't have to create a new pull request. |
Thanks for your suggestion |
When using addtext3d to display 3D text in qvtkwidget, an error "access conflict occurs when reading position 0x000000000000008" will be reported. The reason is that "render - > render()" has been used in addtext3d once, but to send 3D text to qvtkwidget window, execute "UI - > qvtkwidget - > setrenderwindow (viewer - > getrenderwindow());Viewer - > setupinteractor (UI - > qvtkwidget - > getinteractor()); ", which is equivalent to repeated rendering, resulting in pointer out of bounds. To solve this problem it is OK to delete "render - > render()". I have passed the test on vtk8.0.0, Larshg has tested on vtk9.0.1, and vtk6 and 7 have not been tested. Therefore, the judgment statement of VTK version is added.
Error between addtext3d and qvtkwidget
I got time to test it with vtk 6.3 and it seg faults as well so let's just remove the line entirely. |
Thanks for your great work. That is great! |
After successfully testing vtk6,7,just remove “Render->render()” entirely
Fix Bug between addText3D and QVTKWidget
visualization/include/pcl/visualization/impl/pcl_visualizer.hpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Lars Glud <[email protected]>
I've been thinking about the essential reason for this bug recently, but I'm not a computer major. This problem is a little difficult for me. After consulting a lot of blogs and books, I guess the reason for the error is that the memory access is out of bounds. I'm not sure, so I'd like to consult you. I look forward to your reply. Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested (with VTK 9.0.1) and found:
- In connection with Qt/QVTKWidget,
addText3D
segfaults without the fix, but works with the fix - if
PCLVisualizer
is used without Qt/QVTKWidget,addText3D
works fine with and without this fix
So looks good to me
In the VTK 8.0.0,my test is the same as yours |
* Error between addtext3d and qvtkwidget When using addtext3d to display 3D text in qvtkwidget, an error "access conflict occurs when reading position 0x000000000000008" will be reported. The reason is that "render - > render()" has been used in addtext3d once, but to send 3D text to qvtkwidget window, execute "UI - > qvtkwidget - > setrenderwindow (viewer - > getrenderwindow());Viewer - > setupinteractor (UI - > qvtkwidget - > getinteractor()); ", which is equivalent to repeated rendering, resulting in pointer out of bounds. After experiments, it is OK to delete "render - > render()" and it works normally when it does not interact with qvtkwidget * Error between addtext3d and qvtkwidget When using addtext3d to display 3D text in qvtkwidget, an error "access conflict occurs when reading position 0x000000000000008" will be reported. The reason is that "render - > render()" has been used in addtext3d once, but to send 3D text to qvtkwidget window, execute "UI - > qvtkwidget - > setrenderwindow (viewer - > getrenderwindow());Viewer - > setupinteractor (UI - > qvtkwidget - > getinteractor()); ", which is equivalent to repeated rendering, resulting in pointer out of bounds. To solve this problem it is OK to delete "render - > render()". I have passed the test on vtk8.0.0, Larshg has tested on vtk9.0.1, and vtk6 and 7 have not been tested. Therefore, the judgment statement of VTK version is added. * Fix Bug between addText3D and QVTKWidget After successfully testing vtk6,7,just remove “Render->render()” entirely * Apply suggestions from code review Co-authored-by: Lars Glud <[email protected]> Co-authored-by: Lars Glud <[email protected]>
When using addtext3d to display 3D text in qvtkwidget, an error "access conflict occurs when reading position 0x000000000000008" will be reported. The reason is that "render - > render()" has been used in addtext3d once, but to send 3D text to qvtkwidget window, execute "UI - > qvtkwidget - > setrenderwindow (viewer - > getrenderwindow());Viewer - > setupinteractor (UI - > qvtkwidget - > getinteractor()); ", which is equivalent to repeated rendering, resulting in pointer out of bounds.
After experiments, it is OK to delete "render - > render()" and it works normally when it does not interact with qvtkwidget