remove misplaced assert

It's an error to use an env with the wrong thread, but it IS possible
for more than one thread to be associated with the same env. So don't
assert to the contrary.
This commit is contained in:
Eric House 2019-03-03 21:01:23 -08:00
parent eeddd8d7cb
commit 91b7cf8bd9

View file

@ -202,20 +202,17 @@ map_remove_prv( EnvThreadInfo* ti, JNIEnv* env, const char* func )
pthread_mutex_lock( &ti->mtxThreads ); pthread_mutex_lock( &ti->mtxThreads );
for ( int ii = 0; !found && ii < ti->nEntries; ++ii ) { for ( int ii = 0; !found && ii < ti->nEntries; ++ii ) {
found = env == ti->entries[ii].env; EnvThreadEntry* entry = &ti->entries[ii];
found = env == entry->env;
if ( found ) { if ( found ) {
#ifdef LOG_MAPPING #ifdef LOG_MAPPING
XP_LOGF( "%s: UNMAPPED env %p to thread %x (from %s; mapped by %s)", __func__, XP_LOGF( "%s: UNMAPPED env %p to thread %x (from %s; mapped by %s)", __func__,
ti->entries[ii].env, entry->env, (int)entry->owner, func, entry->ownerFunc );
(int)ti->entries[ii].owner, func,
ti->entries[ii].ownerFunc );
#endif
XP_ASSERT( pthread_self() == ti->entries[ii].owner );
ti->entries[ii].env = NULL;
ti->entries[ii].owner = 0;
#ifdef LOG_MAPPING
XP_LOGF( "%s: %d entries left", __func__, countUsed( ti ) ); XP_LOGF( "%s: %d entries left", __func__, countUsed( ti ) );
entry->ownerFunc = NULL;
#endif #endif
entry->env = NULL;
entry->owner = 0;
} }
} }
pthread_mutex_unlock( &ti->mtxThreads ); pthread_mutex_unlock( &ti->mtxThreads );