unlock lock we won't be keeping

This might fix the occasional game permalock.
This commit is contained in:
Eric House 2019-03-09 06:40:04 -08:00
parent c2441c30f4
commit 085963b76c
2 changed files with 9 additions and 1 deletions

View file

@ -581,7 +581,7 @@ public class BoardDelegate extends DelegateBase
m_haveInvited = args.getBoolean( GameUtils.INVITED, false ); m_haveInvited = args.getBoolean( GameUtils.INVITED, false );
m_overNotShown = true; m_overNotShown = true;
GameLock.getLockThen( m_rowid, 100L, new Handler(), GameLock.getLockThen( m_rowid, 100L, new Handler(), // this doesn't unlock
new GameLock.GotLockProc() { new GameLock.GotLockProc() {
@Override @Override
public void gotLock( GameLock lock ) { public void gotLock( GameLock lock ) {

View file

@ -866,6 +866,14 @@ public class JNIThread extends Thread implements AutoCloseable {
if ( null == result && null != lock ) { if ( null == result && null != lock ) {
result = new JNIThread( lock ); result = new JNIThread( lock );
s_instances.put( rowid, result ); s_instances.put( rowid, result );
} else if ( null != lock ) {
// unlock if we're not using it. This is a hack needed because
// we don't have retain/release semantics. The caller is done
// with the lock and expects us to keep it. If we don't need
// it we need to unlock it. Fix is for JNIThread.__init() to
// be able to retain() it and caller to release() it after we
// return.
lock.unlock();
} }
if ( null != result ) { if ( null != result ) {
result.retain_sync(); result.retain_sync();