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

Don't throw when native pointers have long values < 0 #2217

Merged
merged 3 commits into from
Dec 14, 2020

Conversation

matteblair
Copy link
Member

Android 11 and certain ROMs use "tagged pointers" that set the high bits on pointers, causing them to become negative as a long.

See #2215

Android 11 and certain ROMs use "tagged pointers" that set the high bits on pointers, causing them to become negative as a long.
@@ -670,7 +670,7 @@ public MapData addDataLayer(final String name, final boolean generateCentroid) {
return mapData;
}
final long pointer = nativeMap.addClientDataSource(name, generateCentroid);
if (pointer <= 0) {
if (pointer == 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Not to be pedantic, but wouldn't it clarify intention here if it was just pointer == NULL? e.g. pointer <= NULL wouldn't have made sense to a casual reader.

Copy link
Member

Choose a reason for hiding this comment

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

Oh this is Java not C++ code here... maybe that matters.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, Java's null is not the same as NULL in C/C++ and it can't be compared with a long.

Copy link
Member

Choose a reason for hiding this comment

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

sad

@matteblair matteblair merged commit 434f27a into master Dec 14, 2020
@matteblair matteblair deleted the android-tagged-pointer-fix branch December 14, 2020 20:12
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