Fix for CursorWindow leaking native memory #22
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change fixes the native memory leak when running cursors, there were 2 problems one is that the new CursorWindow was storing its Window * in the superclasses nWindow not in the new subclasses nWindow. This would cause android.database.CursorWindow to create a window, then the pointer to it was overrwritten by the info.guardianproject.database.CursorWindow newly created window.
The 2nd issue is that the clean-up did not call through to cleanup the parent class.
I've tested this on a Samsung Galaxy S running 2.2, A Galaxy S2 running 2.3, and a Galaxy Tab running 3.1.
One remaining weirdness is that the window created by android.database.CursorWindow is never used, it'd be nice if there was someway to not have to create that.