mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
start GamePtr with refcount of 1 (for consistency)
This commit is contained in:
parent
8cac030e04
commit
ca2dc0b78f
1 changed files with 4 additions and 3 deletions
|
@ -39,7 +39,7 @@ public class XwJNI {
|
||||||
|
|
||||||
public static class GamePtr implements AutoCloseable {
|
public static class GamePtr implements AutoCloseable {
|
||||||
private long m_ptrGame = 0;
|
private long m_ptrGame = 0;
|
||||||
private int m_refCount = 0;
|
private int m_refCount = 1;
|
||||||
private long m_rowid;
|
private long m_rowid;
|
||||||
private String mStack;
|
private String mStack;
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ public class XwJNI {
|
||||||
|
|
||||||
public synchronized GamePtr retain()
|
public synchronized GamePtr retain()
|
||||||
{
|
{
|
||||||
|
Assert.assertTrueNR( 0 < m_refCount );
|
||||||
++m_refCount;
|
++m_refCount;
|
||||||
Log.d( TAG, "retain(this=%H, rowid=%d): refCount now %d",
|
Log.d( TAG, "retain(this=%H, rowid=%d): refCount now %d",
|
||||||
this, m_rowid, m_refCount );
|
this, m_rowid, m_refCount );
|
||||||
|
@ -230,7 +231,7 @@ public class XwJNI {
|
||||||
CommonPrefs cp, TransportProcs procs )
|
CommonPrefs cp, TransportProcs procs )
|
||||||
|
|
||||||
{
|
{
|
||||||
GamePtr gamePtr = initGameJNI( rowid ).retain();
|
GamePtr gamePtr = initGameJNI( rowid );
|
||||||
if ( ! game_makeFromStream( gamePtr, stream, gi, dictNames, dictBytes,
|
if ( ! game_makeFromStream( gamePtr, stream, gi, dictNames, dictBytes,
|
||||||
dictPaths, langName, util, draw,
|
dictPaths, langName, util, draw,
|
||||||
cp, procs ) ) {
|
cp, procs ) ) {
|
||||||
|
@ -249,7 +250,7 @@ public class XwJNI {
|
||||||
GamePtr gamePtr = initGameJNI( 0 );
|
GamePtr gamePtr = initGameJNI( 0 );
|
||||||
game_makeNewGame( gamePtr, gi, dictNames, dictBytes, dictPaths,
|
game_makeNewGame( gamePtr, gi, dictNames, dictBytes, dictPaths,
|
||||||
langName, util, draw, cp, procs );
|
langName, util, draw, cp, procs );
|
||||||
return gamePtr.retain();
|
return gamePtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// hack to allow cleanup of env owned by thread that doesn't open game
|
// hack to allow cleanup of env owned by thread that doesn't open game
|
||||||
|
|
Loading…
Add table
Reference in a new issue