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

pclvisualizer's interactor_ is nullptr #1997

Closed
renc opened this issue Sep 18, 2017 · 5 comments
Closed

pclvisualizer's interactor_ is nullptr #1997

renc opened this issue Sep 18, 2017 · 5 comments

Comments

@renc
Copy link

renc commented Sep 18, 2017

Hello,

pclvisualizer's interactor_ is nullptr at this usage:

        //m_pViewWidget is a qvtkWidget instance
	m_pViewer.reset(new pcl::visualization::PCLVisualizer("viewer", false));
	m_pViewWidget->SetRenderWindow(m_pViewer->getRenderWindow()); 
	// to use interactor from qvtkWidget
	m_pViewer->setupInteractor(m_pViewWidget->GetInteractor(), m_pViewWidget->GetRenderWindow());
	m_pViewWidget->update();

after this code, the interactor_ is still nullptr, so crash for example m_pViewer->spinOnce().

To fix that, i think maybe at

PCLVisualizer::setupInteractor(....) {
    ... // same as the current version. 
    interactor_ = iren; // add this new line. 
} 

any idea?

@renc
Copy link
Author

renc commented Sep 18, 2017

btw, if this fix make sense, i could help to add a patch. thx.

@taketwo
Copy link
Member

taketwo commented Sep 18, 2017

I'm not entirely sure, but I think you should not call functions like spin() or spinOnce() when you are using external interactor. Your m_pViewWidget will take care of refreshing and redrawing the visualization window.

@renc
Copy link
Author

renc commented Sep 19, 2017

thx taketwo, right that the m_pViewWidget->update() will refresh the window. Leaving interactor_ null seems a bit dangerous.

@taketwo
Copy link
Member

taketwo commented Sep 19, 2017

It's dangerous, true. All accesses to interactor_ need to be guarded with null checks, which is not the case currently. However, setting interactor_ to the external interactor may be not a good idea either, because then we will start calling functions like DestroyTimer, Start, Render, etc on this external instance, which we are not supposed to.

@denix56
Copy link
Contributor

denix56 commented Oct 1, 2017

Some related information with it - when we use QVTKOpenGLWidget it often does not update the displayed object with update() function, you should call Render() method of the current render window. But it seems to be not PCL bug, but VTK.
Maybe it will be useful for somebody.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants