You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Java an "upcall stub" is allocated in case native code wants to callback into a Java method. The upcall stub is allocated in an arena. When the arena is closed, the upcall stub is removed. This introduces a problem for callbacks with scope="notified", because they invoke a GDestroyNotify callback when the original callback is destroyed, and that leaves us with no way to close the arena of the upcall stub for the GDestroyNotify. The current implementation tries to close the arena from inside the GDestroyNotify callback itself, but that causes the JVM to segfault.
A solution could be to create a global static HashMap of arenas for notified callbacks, indexed by the arena hashcode. Then, create a globally-allocated static callback method that satisfies the GDestroyNotify function signature. It reads the arena hashcode from the data argument and closes that arena. Use this callback for all notified function parameters (passing the arena hashcode in the data argument).
If this works, the same principle can be used for g_signal_connect_data, to close the arena for disconnected signals. This currently is a manual action and requires a call to SignalHandler.close(). If that action is unnecessary, the entire SignalHandler API can probably be removed.
The text was updated successfully, but these errors were encountered:
In Java an "upcall stub" is allocated in case native code wants to callback into a Java method. The upcall stub is allocated in an arena. When the arena is closed, the upcall stub is removed. This introduces a problem for callbacks with
scope="notified"
, because they invoke aGDestroyNotify
callback when the original callback is destroyed, and that leaves us with no way to close the arena of the upcall stub for theGDestroyNotify
. The current implementation tries to close the arena from inside theGDestroyNotify
callback itself, but that causes the JVM to segfault.A solution could be to create a global static HashMap of arenas for
notified
callbacks, indexed by the arena hashcode. Then, create a globally-allocated static callback method that satisfies theGDestroyNotify
function signature. It reads the arena hashcode from thedata
argument and closes that arena. Use this callback for allnotified
function parameters (passing the arena hashcode in thedata
argument).If this works, the same principle can be used for
g_signal_connect_data
, to close the arena for disconnected signals. This currently is a manual action and requires a call toSignalHandler.close()
. If that action is unnecessary, the entireSignalHandler
API can probably be removed.The text was updated successfully, but these errors were encountered: