Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get a segment fault running example code #132

Open
lqzerogg opened this issue Jun 13, 2024 · 0 comments
Open

get a segment fault running example code #132

lqzerogg opened this issue Jun 13, 2024 · 0 comments

Comments

@lqzerogg
Copy link

lqzerogg commented Jun 13, 2024

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:

  1. download the code, 'https://github.com/lqzerogg/docbuildertest'
  2. mkdir docbuildertest/build && cd docubuildertest/build
  3. cmake ../
  4. make
  5. ./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/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant