mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
add debug-only logging toward figuring out occasional bad-dict crash
This commit is contained in:
parent
57cd547078
commit
b29dcb1d2c
3 changed files with 23 additions and 0 deletions
|
@ -42,6 +42,9 @@ typedef struct _AndDictionaryCtxt {
|
|||
off_t bytesSize;
|
||||
jbyte* bytes;
|
||||
jbyteArray byteArray;
|
||||
#ifdef DEBUG
|
||||
uint32_t dbgid;
|
||||
#endif
|
||||
} AndDictionaryCtxt;
|
||||
|
||||
#define CHECK_PTR(p,c,e) \
|
||||
|
@ -487,6 +490,7 @@ static void
|
|||
and_dictionary_destroy( DictionaryCtxt* dict )
|
||||
{
|
||||
AndDictionaryCtxt* ctxt = (AndDictionaryCtxt*)dict;
|
||||
XP_LOGF( "%s(dict=%p); code=%x", __func__, ctxt, ctxt->dbgid );
|
||||
XP_U16 nSpecials = andCountSpecials( ctxt );
|
||||
XP_U16 ii;
|
||||
JNIEnv* env = ctxt->env;
|
||||
|
@ -553,6 +557,9 @@ and_dictionary_make_empty( MPFORMAL JNIEnv* env, JNIUtilCtxt* jniutil )
|
|||
= (AndDictionaryCtxt*)XP_CALLOC( mpool, sizeof( *anddict ) );
|
||||
anddict->env = env;
|
||||
anddict->jniutil = jniutil;
|
||||
#ifdef DEBUG
|
||||
anddict->dbgid = rand();
|
||||
#endif
|
||||
dict_super_init( (DictionaryCtxt*)anddict );
|
||||
MPASSIGN( anddict->super.mpool, mpool );
|
||||
return (DictionaryCtxt*)anddict;
|
||||
|
@ -635,6 +642,8 @@ makeDict( MPFORMAL JNIEnv *env, JNIUtilCtxt* jniutil, jstring jname,
|
|||
|
||||
/* copy the name */
|
||||
anddict->super.name = getStringCopy( MPPARM(mpool) env, jname );
|
||||
XP_LOGF( "%s(dict=%p); code=%x; name=%s", __func__, anddict,
|
||||
anddict->dbgid, anddict->super.name );
|
||||
anddict->super.langName = getStringCopy( MPPARM(mpool) env, jlangname );
|
||||
|
||||
XP_U32 numEdges;
|
||||
|
@ -664,3 +673,12 @@ destroyDicts( PlayerDicts* dicts )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
uint32_t
|
||||
andDictID( DictionaryCtxt* dict )
|
||||
{
|
||||
AndDictionaryCtxt* ctxt = (AndDictionaryCtxt*)dict;
|
||||
return ctxt->dbgid;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -44,4 +44,8 @@ DictionaryCtxt* and_dictionary_make_empty( MPFORMAL JNIEnv *env,
|
|||
|
||||
jobject and_dictionary_getChars( JNIEnv* env, DictionaryCtxt* dict );
|
||||
|
||||
# ifdef DEBUG
|
||||
uint32_t andDictID(DictionaryCtxt* dict);
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -517,6 +517,7 @@ static void
|
|||
and_draw_dictChanged( DrawCtx* dctx, XP_S16 playerNum,
|
||||
const DictionaryCtxt* dict )
|
||||
{
|
||||
XP_LOGF( "%s(dict=%p); code=%x", __func__, dict, andDictID(dict) );
|
||||
AndDraw* draw = (AndDraw*)dctx;
|
||||
if ( NULL != draw->jdraw ) {
|
||||
XP_LangCode code = 0; /* A null dict means no-lang */
|
||||
|
|
Loading…
Reference in a new issue