mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-22 07:28:16 +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;
|
off_t bytesSize;
|
||||||
jbyte* bytes;
|
jbyte* bytes;
|
||||||
jbyteArray byteArray;
|
jbyteArray byteArray;
|
||||||
|
#ifdef DEBUG
|
||||||
|
uint32_t dbgid;
|
||||||
|
#endif
|
||||||
} AndDictionaryCtxt;
|
} AndDictionaryCtxt;
|
||||||
|
|
||||||
#define CHECK_PTR(p,c,e) \
|
#define CHECK_PTR(p,c,e) \
|
||||||
|
@ -487,6 +490,7 @@ static void
|
||||||
and_dictionary_destroy( DictionaryCtxt* dict )
|
and_dictionary_destroy( DictionaryCtxt* dict )
|
||||||
{
|
{
|
||||||
AndDictionaryCtxt* ctxt = (AndDictionaryCtxt*)dict;
|
AndDictionaryCtxt* ctxt = (AndDictionaryCtxt*)dict;
|
||||||
|
XP_LOGF( "%s(dict=%p); code=%x", __func__, ctxt, ctxt->dbgid );
|
||||||
XP_U16 nSpecials = andCountSpecials( ctxt );
|
XP_U16 nSpecials = andCountSpecials( ctxt );
|
||||||
XP_U16 ii;
|
XP_U16 ii;
|
||||||
JNIEnv* env = ctxt->env;
|
JNIEnv* env = ctxt->env;
|
||||||
|
@ -553,6 +557,9 @@ and_dictionary_make_empty( MPFORMAL JNIEnv* env, JNIUtilCtxt* jniutil )
|
||||||
= (AndDictionaryCtxt*)XP_CALLOC( mpool, sizeof( *anddict ) );
|
= (AndDictionaryCtxt*)XP_CALLOC( mpool, sizeof( *anddict ) );
|
||||||
anddict->env = env;
|
anddict->env = env;
|
||||||
anddict->jniutil = jniutil;
|
anddict->jniutil = jniutil;
|
||||||
|
#ifdef DEBUG
|
||||||
|
anddict->dbgid = rand();
|
||||||
|
#endif
|
||||||
dict_super_init( (DictionaryCtxt*)anddict );
|
dict_super_init( (DictionaryCtxt*)anddict );
|
||||||
MPASSIGN( anddict->super.mpool, mpool );
|
MPASSIGN( anddict->super.mpool, mpool );
|
||||||
return (DictionaryCtxt*)anddict;
|
return (DictionaryCtxt*)anddict;
|
||||||
|
@ -635,6 +642,8 @@ makeDict( MPFORMAL JNIEnv *env, JNIUtilCtxt* jniutil, jstring jname,
|
||||||
|
|
||||||
/* copy the name */
|
/* copy the name */
|
||||||
anddict->super.name = getStringCopy( MPPARM(mpool) env, jname );
|
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 );
|
anddict->super.langName = getStringCopy( MPPARM(mpool) env, jlangname );
|
||||||
|
|
||||||
XP_U32 numEdges;
|
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 );
|
jobject and_dictionary_getChars( JNIEnv* env, DictionaryCtxt* dict );
|
||||||
|
|
||||||
|
# ifdef DEBUG
|
||||||
|
uint32_t andDictID(DictionaryCtxt* dict);
|
||||||
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -517,6 +517,7 @@ static void
|
||||||
and_draw_dictChanged( DrawCtx* dctx, XP_S16 playerNum,
|
and_draw_dictChanged( DrawCtx* dctx, XP_S16 playerNum,
|
||||||
const DictionaryCtxt* dict )
|
const DictionaryCtxt* dict )
|
||||||
{
|
{
|
||||||
|
XP_LOGF( "%s(dict=%p); code=%x", __func__, dict, andDictID(dict) );
|
||||||
AndDraw* draw = (AndDraw*)dctx;
|
AndDraw* draw = (AndDraw*)dctx;
|
||||||
if ( NULL != draw->jdraw ) {
|
if ( NULL != draw->jdraw ) {
|
||||||
XP_LangCode code = 0; /* A null dict means no-lang */
|
XP_LangCode code = 0; /* A null dict means no-lang */
|
||||||
|
|
Loading…
Reference in a new issue