mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
in debug builds track who sets env so we can log who has it on
conflict rather than just assert.
This commit is contained in:
parent
62b586d322
commit
b6aaf6c38c
1 changed files with 17 additions and 1 deletions
|
@ -265,16 +265,32 @@ typedef struct _JNIState {
|
|||
XWGame game;
|
||||
JNIEnv* env;
|
||||
AndGlobals globals;
|
||||
#ifdef DEBUG
|
||||
const char* envSetterFunc;
|
||||
#endif
|
||||
MPSLOT
|
||||
} JNIState;
|
||||
|
||||
#ifdef DEBUG
|
||||
# define CHECK_ENV() \
|
||||
if ( state->env != 0 && state->env != env ) { \
|
||||
XP_LOGF( "ERROR: %s trying to set env when %s still has it", \
|
||||
__func__, state->envSetterFunc ); \
|
||||
XP_ASSERT( state->env == 0 || state->env == env ); \
|
||||
} \
|
||||
state->envSetterFunc = __func__; \
|
||||
|
||||
#else
|
||||
# define CHECK_ENV()
|
||||
#endif
|
||||
|
||||
#define XWJNI_START() { \
|
||||
XP_ASSERT( 0 != gamePtr ); \
|
||||
JNIState* state = (JNIState*)gamePtr; \
|
||||
MPSLOT; \
|
||||
MPASSIGN( mpool, state->mpool); \
|
||||
/* if reentrant must be from same thread */ \
|
||||
XP_ASSERT( state->env == 0 || state->env == env ); \
|
||||
CHECK_ENV(); \
|
||||
JNIEnv* _oldEnv = state->env; \
|
||||
state->env = env;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue