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

Bug in pointcloudmapping.cc PointCloudMapping::viewer() #38

Open
MelancholyMethane opened this issue Jan 25, 2022 · 0 comments
Open

Bug in pointcloudmapping.cc PointCloudMapping::viewer() #38

MelancholyMethane opened this issue Jan 25, 2022 · 0 comments

Comments

@MelancholyMethane
Copy link

A lock should be added when calling generatePointCloud, or the addresses of the vectors may shift when other threads execute the push_back operation.
This is especially likely to happen in a device where the memory is limited and the memory block allocated initially is not large enough. If it happens, a segmentation fault will result.
Wrong:

        for ( size_t i=lastKeyframeSize; i<N ; i++ )
        {
            PointCloud::Ptr p = generatePointCloud( keyframes[i],semanticImgs_color[i], semanticImgs[i],colorImgs[i], depthImgs[i] );
	        *KfMap += *p;
	        *globalMap += *p;	    
        }

A possible correction:

        for ( size_t i=lastKeyframeSize; i<N ; i++ )
        {
            unique_lock<mutex> lck(keyframeMutex);
            PointCloud::Ptr p = generatePointCloud( keyframes[i],semanticImgs_color[i], semanticImgs[i],colorImgs[i], depthImgs[i] );
	        *KfMap += *p;
	        *globalMap += *p;	    
        }
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

1 participant