don't ref dicts from dmgr_get()

This commit is contained in:
Eric House 2014-03-10 21:50:06 -07:00
parent a4302897e2
commit dee75f5a0a

View file

@ -613,6 +613,7 @@ makeDict( MPFORMAL JNIEnv *env, DictMgrCtxt* dictMgr, JNIUtilCtxt* jniutil, jstr
off_t bytesSize = 0; off_t bytesSize = 0;
const char* name = (*env)->GetStringUTFChars( env, jname, NULL ); const char* name = (*env)->GetStringUTFChars( env, jname, NULL );
/* remember: dmgr_get calls dict_ref() */
AndDictionaryCtxt* anddict = (AndDictionaryCtxt*)dmgr_get( dictMgr, name ); AndDictionaryCtxt* anddict = (AndDictionaryCtxt*)dmgr_get( dictMgr, name );
if ( NULL == anddict ) { if ( NULL == anddict ) {
@ -665,12 +666,12 @@ makeDict( MPFORMAL JNIEnv *env, DictMgrCtxt* dictMgr, JNIUtilCtxt* jniutil, jstr
} }
} }
dmgr_put( dictMgr, name, &anddict->super ); dmgr_put( dictMgr, name, &anddict->super );
dict_ref( &anddict->super );
} }
(*env)->ReleaseStringUTFChars( env, jname, name ); (*env)->ReleaseStringUTFChars( env, jname, name );
DictionaryCtxt* result = dict_ref( (DictionaryCtxt*)anddict ); /* NULL ok */ return &anddict->super;
return result;
} /* makeDict */ } /* makeDict */
#ifdef DEBUG #ifdef DEBUG