Skip to content

Commit

Permalink
Merge pull request #1631 from SergioRAgostinho/pcl_visualizer
Browse files Browse the repository at this point in the history
Fixes  pcl_visualizer tutorial crash in interactive mode
  • Loading branch information
taketwo authored Aug 18, 2016
2 parents 40b5cd8 + 285b7f8 commit 7a33b57
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ unsigned int text_id = 0;
void keyboardEventOccurred (const pcl::visualization::KeyboardEvent &event,
void* viewer_void)
{
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer = *static_cast<boost::shared_ptr<pcl::visualization::PCLVisualizer> *> (viewer_void);
pcl::visualization::PCLVisualizer *viewer = static_cast<pcl::visualization::PCLVisualizer *> (viewer_void);
if (event.getKeySym () == "r" && event.keyDown ())
{
std::cout << "r was pressed => removing all text" << std::endl;
Expand All @@ -195,7 +195,7 @@ void keyboardEventOccurred (const pcl::visualization::KeyboardEvent &event,
void mouseEventOccurred (const pcl::visualization::MouseEvent &event,
void* viewer_void)
{
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer = *static_cast<boost::shared_ptr<pcl::visualization::PCLVisualizer> *> (viewer_void);
pcl::visualization::PCLVisualizer *viewer = static_cast<pcl::visualization::PCLVisualizer *> (viewer_void);
if (event.getButton () == pcl::visualization::MouseEvent::LeftButton &&
event.getType () == pcl::visualization::MouseEvent::MouseButtonRelease)
{
Expand All @@ -213,8 +213,8 @@ boost::shared_ptr<pcl::visualization::PCLVisualizer> interactionCustomizationVis
viewer->setBackgroundColor (0, 0, 0);
viewer->addCoordinateSystem (1.0);

viewer->registerKeyboardCallback (keyboardEventOccurred, (void*)&viewer);
viewer->registerMouseCallback (mouseEventOccurred, (void*)&viewer);
viewer->registerKeyboardCallback (keyboardEventOccurred, (void*)viewer.get ());
viewer->registerMouseCallback (mouseEventOccurred, (void*)viewer.get ());

return (viewer);
}
Expand Down

0 comments on commit 7a33b57

Please sign in to comment.