Some cleanup after moving to std::make_shared

Addresses Tatyana Krasnukha's feedback from D57990.

llvm-svn: 353768
This commit is contained in:
Jonas Devlieghere 2019-02-11 23:48:59 +00:00
parent cf39dd44b8
commit c6091d2bed
2 changed files with 13 additions and 21 deletions

View File

@ -993,22 +993,15 @@ public:
WindowSP CreateSubWindow(const char *name, const Rect &bounds,
bool make_active) {
WindowSP subwindow_sp;
if (m_window) {
subwindow_sp = std::make_shared<Window>(
name,
::subwin(m_window, bounds.size.height, bounds.size.width,
bounds.origin.y, bounds.origin.x),
true);
subwindow_sp->m_is_subwin = true;
} else {
subwindow_sp = std::make_shared<Window>(
name,
::newwin(bounds.size.height, bounds.size.width, bounds.origin.y,
bounds.origin.x),
true);
subwindow_sp->m_is_subwin = false;
}
auto get_window = [this, &bounds]() {
return m_window
? ::subwin(m_window, bounds.size.height, bounds.size.width,
bounds.origin.y, bounds.origin.x)
: ::newwin(bounds.size.height, bounds.size.width,
bounds.origin.y, bounds.origin.x);
};
WindowSP subwindow_sp = std::make_shared<Window>(name, get_window(), true);
subwindow_sp->m_is_subwin = subwindow_sp.operator bool();
subwindow_sp->m_parent = this;
if (make_active) {
m_prev_active_window_idx = m_curr_active_window_idx;

View File

@ -1602,13 +1602,12 @@ void Thread::CalculateExecutionContext(ExecutionContext &exe_ctx) {
StackFrameListSP Thread::GetStackFrameList() {
StackFrameListSP frame_list_sp;
std::lock_guard<std::recursive_mutex> guard(m_frame_mutex);
if (m_curr_frames_sp) {
frame_list_sp = m_curr_frames_sp;
} else {
if (!m_curr_frames_sp)
frame_list_sp =
std::make_shared<StackFrameList>(*this, m_prev_frames_sp, true);
m_curr_frames_sp = frame_list_sp;
}
frame_list_sp = m_curr_frames_sp;
return frame_list_sp;
}