[lldb/python] Avoid more dangling pointers in python glue code

This commit is contained in:
Pavel Labath
2021-12-17 13:02:21 +01:00
parent ede7c2438f
commit 2efc6892d8
8 changed files with 64 additions and 103 deletions

View File

@@ -119,15 +119,13 @@ SBSymbolContext SBFrame::GetSymbolContext(uint32_t resolve_scope) const {
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
StackFrame *frame = nullptr;
Target *target = exe_ctx.GetTargetPtr();
Process *process = exe_ctx.GetProcessPtr();
if (target && process) {
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&process->GetRunLock())) {
frame = exe_ctx.GetFramePtr();
if (frame)
sb_sym_ctx.SetSymbolContext(&frame->GetSymbolContext(scope));
if (StackFrame *frame = exe_ctx.GetFramePtr())
sb_sym_ctx = frame->GetSymbolContext(scope);
}
}