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

Make sure stale object pointers don't hang around #87

Merged
merged 2 commits into from Jan 3, 2022

Conversation

monich
Copy link
Contributor

@monich monich commented Jan 2, 2022

When an object is being finalized, other thread may re-reference the object right before it gets removed from the table (making ref_count greater than 1) and then quickly release that reference before g_object_unref() re-checks the refcount.

If that happens, the object may remain in the table by time when its finalize() callback is called. That applies both to local and remote objects.

We still have to invalidate the handle in dispose() callback because it's the last point when GObject can be legitimately re-referenced and brought back to life.

When an object is being finalized, other thread may re-reference the
object right before it gets removed from the table (making ref_count
greater than 1) and then quickly release that reference before
g_object_unref() re-checks the refcount.

If that happens, the object may remain in the table by time when its
finalize() callback is called. That applies both to local and remote
objects.

We still have to invalidate the handle in dispose() callback because
it's the last point when GObject can be legitimately re-referenced and
brought back to life.
Every gbinder_driver_release() must be accompanied by
gbinder_ipc_invalidate_remote_handle() because the former
releases the node and allows the kernel to reuse the handle.
@monich monich merged commit 6e127bd into mer-hybris:master Jan 3, 2022
@monich monich deleted the invalidate branch January 3, 2022 11:34
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

2 participants