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

Global: Fix some DeepScan issues. #23351

Merged
merged 1 commit into from
Jan 27, 2022
Merged

Global: Fix some DeepScan issues. #23351

merged 1 commit into from
Jan 27, 2022

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jan 27, 2022

Related issue: -

Description

It's impressive how many issues DeepScan can detect. I've fixed some of them with this PR.

this.workerPool.dispose();
if ( this.workerSourceURL ) URL.revokeObjectURL( this.workerSourceURL );
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@donmccurdy dispose() was implemented two times. I hope this final version is the correct one 😉 .

@@ -124,7 +124,8 @@ function isUniqueEdge( start, end, edges ) {

} else {

edges.add( hash1, hash2 );
edges.add( hash1 );
edges.add( hash2 );
Copy link
Collaborator Author

@Mugen87 Mugen87 Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually an important fix since hash2 was never added to edges.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it means that we were still generating duplicated lines?

Copy link
Collaborator Author

@Mugen87 Mugen87 Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both hashes should be part of edges. The new code ensures that this is the case and duplicates should be avoided now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both hashes should be part of edges.

I do not think that is necessary.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[needs investigation]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a second look it's indeed sufficient to only store a single edge. The coincident edge is not required in the set since when an edge is tested, isUniqueEdge() generates two hashes for testing the actual and the coincident edge.

However, I don't think the logic is "wrong". Storing both edges allows a potential early out in isUniqueEdge() ( you can safe a call of Set.has()).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a second look it's indeed sufficient to only store a single edge.

As I said, the coincident edge did not have to be added to the set in this PR.

If you insist on adding both edges to the set, then you can compute hash2 only when it is added. Your choice. :-)

@mrdoob
Copy link
Owner

mrdoob commented Jan 27, 2022

It's impressive how many issues DeepScan can detect.

Yeah!

@mrdoob mrdoob added this to the r138 milestone Jan 27, 2022
@mrdoob mrdoob merged commit fadb6ab into mrdoob:dev Jan 27, 2022
@mrdoob
Copy link
Owner

mrdoob commented Jan 27, 2022

Thanks!

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.

None yet

3 participants