summaryrefslogtreecommitdiff
path: root/runtime/thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/thread.cc')
-rw-r--r--runtime/thread.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc
index d2d5be7c1e..527d758ab0 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -982,8 +982,9 @@ static bool ShouldShowNativeStack(const Thread* thread)
void Thread::DumpJavaStack(std::ostream& os) const {
// Dumping the Java stack involves the verifier for locks. The verifier operates under the
// assumption that there is no exception pending on entry. Thus, stash any pending exception.
- // TODO: Find a way to avoid const_cast.
- StackHandleScope<3> scope(const_cast<Thread*>(this));
+ // Thread::Current() instead of this in case a thread is dumping the stack of another suspended
+ // thread.
+ StackHandleScope<3> scope(Thread::Current());
Handle<mirror::Throwable> exc;
Handle<mirror::Object> throw_location_this_object;
Handle<mirror::ArtMethod> throw_location_method;