Skip to content

Commit

Permalink
Fix DialectContext destructor
Browse files Browse the repository at this point in the history
It ended up destructing the extension pointers multiple times.
Interestingly, this crashed on Windows before it did on Linux.
  • Loading branch information
nhaehnle committed Jan 4, 2024
1 parent bc5d060 commit 8fca758
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/Dialect/Dialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ DialectContext::~DialectContext() {

std::unique_ptr<ContextExtensionBase> *extensionArray =
getTrailingObjects<std::unique_ptr<ContextExtensionBase>>();
for (unsigned i = 0; i < m_extensionArraySize; ++i)
std::destroy_n(extensionArray, m_extensionArraySize);
std::destroy_n(extensionArray, m_extensionArraySize);

Dialect **dialectArray = getTrailingObjects<Dialect *>();
for (unsigned i = 0; i < m_dialectArraySize; ++i)
Expand Down

0 comments on commit 8fca758

Please sign in to comment.