Avoid crash in SourceImpl constructor.

The Frame constructor calls back into SourceImpl (the passed this reference),
and when in-place constructed in the SourceImpl constructor, SourceImpl
is only partially constructed.
This commit is contained in:
Peter Johnson
2016-12-21 08:51:04 -08:00
parent 80abf6bf24
commit 88afefe464

View File

@@ -19,8 +19,9 @@ using namespace cs;
static constexpr std::size_t kMaxImagesAvail = 32;
SourceImpl::SourceImpl(llvm::StringRef name)
: m_name{name}, m_frame{*this, llvm::StringRef{}, 0} {}
SourceImpl::SourceImpl(llvm::StringRef name) : m_name{name} {
m_frame = Frame{*this, llvm::StringRef{}, 0};
}
SourceImpl::~SourceImpl() {
// Wake up anyone who is waiting. This also clears the current frame,