mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
need to copy worksheet_ipml before modifying worksheet container, otherwise handle become invalid during realloc
This commit is contained in:
parent
b56722ed65
commit
ad69dcb335
|
@ -39,7 +39,7 @@ public:
|
|||
xlnt::workbook wb;
|
||||
auto new_sheet = wb.create_sheet();
|
||||
wb.add_sheet(new_sheet);
|
||||
TS_ASSERT(new_sheet.compare(wb[2], false));
|
||||
TS_ASSERT(wb[1].compare(wb[2], false));
|
||||
}
|
||||
|
||||
// void test_add_sheetname() {} unnecessary
|
||||
|
|
|
@ -160,7 +160,9 @@ worksheet workbook::create_sheet()
|
|||
void workbook::add_sheet(xlnt::worksheet worksheet)
|
||||
{
|
||||
if(worksheet.d_->parent_ != this) throw xlnt::value_error();
|
||||
d_->worksheets_.emplace_back(*worksheet.d_);
|
||||
|
||||
xlnt::detail::worksheet_impl impl(*worksheet.d_);
|
||||
*create_sheet().d_ = impl;
|
||||
}
|
||||
|
||||
void workbook::add_sheet(xlnt::worksheet worksheet, std::size_t index)
|
||||
|
|
Loading…
Reference in New Issue
Block a user