mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #463] Bug: Read access violation is thrown when using "workbook_add_worksheet()" in a static function #361
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#361
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @HeyoItsMateo on GitHub (Dec 8, 2024).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/463
Hello,
I am trying to write a wrapper to make use of libxlsxwriter more streamlined and I am running into an access read violation during a call to
workbook_add_worksheet()in astaticfunction.The XLSL object is defined as:
And the operations done in the main function are:
Here is the sequence of function calls that led to the error (oldest call to most recent):
->
XLSX::add_sheet("SheetName")->
workbook_add_worksheet(p_workbook, sheetName.c_str())->
workbook_validate_sheet_name(self, init_data.name)->
workbook_get_worksheet_by_name(self, sheetname)->
RB_FIND(lxw_worksheet_names, self->worksheet_names, &worksheet_name)Error: access violation reading location.
Looking at the variables reveals the issue in
self->worksheet_names:self->worksheet_names = 0x000002353f26c500 {rbh_root=0x0000000000000000 <NULL> }With the members being unable to be read:
self->worksheet_names->rbh_root->name = <Unable to read memory>However, if I remove the
statickeyword from the functionadd_sheet(), the error goes away.Nothing else in the XLSX
structis changed, but the main function is adjusted to account for the removal of thestatickeyword.The working main function is below:
@jmcnamara commented on GitHub (Dec 9, 2024):
I don't think I can help you here. As far as I can see it is a C++ issue and not a direct issue with libxlsxwriter. You will probably get a better answer on a C++ forum.
There is also an existing CPP wrapper for libxlsxwriter: https://github.com/Alexhuszagh/libxlsxwriterpp
It is a bit out of date but it may help you as a starting point.