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

Fix min/max position not being correct due to multithreading #537

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

CCInc
Copy link
Contributor

@CCInc CCInc commented Oct 4, 2021

The code was in place to handle this:

			// merge min/max of this batch into global min/max
			for (int i = 0; i < outputAttributesCopy.list.size(); i++)
			{
				Attribute &source = outputAttributesCopy.list[i];
				Attribute &target = outputAttributes.list[i];

				lock_guard<mutex> lock(mtx_attributes);
				target.min.x = std::min(target.min.x, source.min.x);
				target.min.y = std::min(target.min.y, source.min.y);
				target.min.z = std::min(target.min.z, source.min.z);

				target.max.x = std::max(target.max.x, source.max.x);
				target.max.y = std::max(target.max.y, source.max.y);
				target.max.z = std::max(target.max.z, source.max.z);
			}

However, outputAttributesCopy min/max was never being set; instead, outputAttributes min/max we being assigned to directly. As a result, the code above did not do anything, and outputAttributes got improperly assigned/overriden by multiple threads.

# Conflicts:
#	Converter/src/chunker_countsort_laszip.cpp
@m-schuetz
Copy link
Collaborator

This is specifically for the position attribute, which doesn't get an attribute handler that populates the copy as it should, right?
Your PR seems to make sense. Thanks!

@m-schuetz m-schuetz merged commit dab44a7 into potree:develop Jun 2, 2022
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

Successfully merging this pull request may close these issues.

2 participants