DocumentBuilder
DocumentBuilder copied to clipboard
get a segment fault running example code
Describe your problem: I run the example code of C++ BUILDER.FRAMEWORK api, but got a segment fault error on this line 'CContext oContext = oBuilder.GetContext();' ` // Main function int main(int argc, char* argv[]) { CDocBuilder::Initialize(workDir); CDocBuilder oBuilder; oBuilder.SetProperty("--work-directory", workDir);
oBuilder.CreateFile(fileExtension);
CContext oContext = oBuilder.GetContext();
CContextScope oScope = oContext.CreateScope();
CValue oGlobal = oContext.GetGlobal();
CValue oApi = oGlobal["Api"];
CValue oDocument = oApi.Call("GetDocument");
CValue oParagraph = oApi.Call("CreateParagraph");
oParagraph.Call("SetSpacingAfter", 1000, false);
oParagraph.Call("AddText", "Hello, world!");
CValue oContent = oContext.CreateArray(1);
oContent[0] = oParagraph;
oDocument.Call("InsertContent", oContent);
oBuilder.SaveFile(fileExtension, sDstPath);
oBuilder.CloseFile();
CDocBuilder::Dispose();
return 0;
} ` Steps to reproduce the problem:
- download the code, 'https://github.com/lqzerogg/docbuildertest'
-
mkdir docbuildertest/build && cd docubuildertest/build
-
cmake ../
-
make
-
./main
DocumentBuilder version: v8.0.0.99
Installation method:
download from this website 'https://www.onlyoffice.com/download-builder.aspx?from=api'. then install locally.
sudo apt install ./onlyoffice-documentbuilder_amd64.deb
Operating system: PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"