At Wed, 26 Mar 2014 02:43:49 +0000,
Chris Ellis wrote:Nice catch. ACK.
>
> Currently nothing prevents the JNA callback objects used when registering
> for domain events from being garbage collected. JNA requires that callback
> objects are not GCed whilst they are in use by C code.
>
> To solve this we hold a reference to the callback alongside the callback id.
> This ensures that the JNA callback objects will retain in memory while it is
> registered with the C layer.
>
> We also use an IdentityHashMap rather than a HashMap to store the EventListener
> objects.
> ---
> src/main/java/org/libvirt/Connect.java | 37 ++++++++++++++++++++++------------
> 1 file changed, 24 insertions(+), 13 deletions(-)
Should we squash this into patch 41/65 before pushing the series?