diff options
-rw-r--r-- | libjava/ChangeLog | 13 | ||||
-rw-r--r-- | libjava/jvmti.cc | 26 |
2 files changed, 27 insertions, 12 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 27f582d..4dd7bac 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,16 @@ +2006-09-19 Keith Seitz <keiths@redhat.com> + + * jvmti.cc (THREAD_DEFAULT_TO_CURRENT): Clarify parameter list. + (THREAD_CHECK_VALID): Likewise. + (THREAD_CHECK_ALIVE): Likewise. + (_Jv_JVMTI_SuspendThread): Call THREAD_CHECK_VALID on a Thread not + jthread. + (_Jv_JVMTI_ResumeThread): Likewise. + (_Jv_JVMTI_InterruptThread): Likewise. + + (_Jv_JVMTI_DisposeEnvironment): Probably unwise to dereference an object + that was just freed. + 2006-09-19 Mark Wielaard <mark@klomp.org> Fixes bug #29137 diff --git a/libjava/jvmti.cc b/libjava/jvmti.cc index 37daa36..a522374 100644 --- a/libjava/jvmti.cc +++ b/libjava/jvmti.cc @@ -56,26 +56,26 @@ static java::lang::Object *_envListLock = NULL; // Some commonly-used checks -#define THREAD_DEFAULT_TO_CURRENT(jthread) \ +#define THREAD_DEFAULT_TO_CURRENT(Ajthread) \ do \ { \ - if (jthread == NULL) \ - jthread = java::lang::Thread::currentThread (); \ + if (Ajthread == NULL) \ + Ajthread = java::lang::Thread::currentThread (); \ } \ while (0) -#define THREAD_CHECK_VALID(jthread) \ +#define THREAD_CHECK_VALID(Athread) \ do \ { \ - if (!java::lang::Thread::class$.isAssignableFrom (&(jthread->class$))) \ + if (!java::lang::Thread::class$.isAssignableFrom (&(Athread->class$))) \ return JVMTI_ERROR_INVALID_THREAD; \ } \ while (0) -#define THREAD_CHECK_IS_ALIVE(thread) \ +#define THREAD_CHECK_IS_ALIVE(Athread) \ do \ { \ - if (!thread->isAlive ()) \ + if (!Athread->isAlive ()) \ return JVMTI_ERROR_THREAD_NOT_ALIVE; \ } \ while (0) @@ -106,9 +106,9 @@ _Jv_JVMTI_SuspendThread (MAYBE_UNUSED jvmtiEnv *env, jthread thread) using namespace java::lang; THREAD_DEFAULT_TO_CURRENT (thread); - THREAD_CHECK_VALID (thread); - + Thread *t = reinterpret_cast<Thread *> (thread); + THREAD_CHECK_VALID (t); THREAD_CHECK_IS_ALIVE (t); _Jv_Thread_t *data = _Jv_ThreadGetData (t); @@ -122,9 +122,9 @@ _Jv_JVMTI_ResumeThread (MAYBE_UNUSED jvmtiEnv *env, jthread thread) using namespace java::lang; THREAD_DEFAULT_TO_CURRENT (thread); - THREAD_CHECK_VALID (thread); Thread *t = reinterpret_cast<Thread *> (thread); + THREAD_CHECK_VALID (t); THREAD_CHECK_IS_ALIVE (t); _Jv_Thread_t *data = _Jv_ThreadGetData (t); @@ -141,8 +141,9 @@ _Jv_JVMTI_InterruptThread (MAYBE_UNUSED jvmtiEnv *env, jthread thread) // FIXME: capability handling? 'can_signal_thread' if (thread == NULL) return JVMTI_ERROR_INVALID_THREAD; - THREAD_CHECK_VALID (thread); + Thread *real_thread = reinterpret_cast<Thread *> (thread); + THREAD_CHECK_VALID (real_thread); THREAD_CHECK_IS_ALIVE (real_thread); real_thread->interrupt(); return JVMTI_ERROR_NONE; @@ -487,8 +488,9 @@ _Jv_JVMTI_DisposeEnvironment (jvmtiEnv *env) JvSynchronize dummy (_envListLock); if (_jvmtiEnvironments->env == env) { + struct jvmti_env_list *next = _jvmtiEnvironments->next; _Jv_Free (_jvmtiEnvironments); - _jvmtiEnvironments = _jvmtiEnvironments->next; + _jvmtiEnvironments = next; } else { |