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

Saving a document frees resources and makes it invalid for further editing #215

Open
joergbrech opened this issue Jan 25, 2023 · 0 comments

Comments

@joergbrech
Copy link
Contributor

saveDocument frees resources and sets the document status to SAVED.

tixi/src/tixiInternal.c

Lines 1233 to 1237 in 470570d

free(document->xmlFilename);
document->xmlFilename = (char*) malloc(sizeof(char) * (strlen(xmlFilename) + 1));
strcpy(document->xmlFilename, xmlFilename);
document->status = SAVED;

As a consequence, a saved document cannot be edited anymore:

tixi/src/tixiImpl.c

Lines 1231 to 1234 in 470570d

if (document->status == SAVED) {
printMsg(MESSAGETYPE_ERROR, "Error: Can not add element to document. Document already saved.\n");
return ALREADY_SAVED;
}

This is counter-intuitive, because there is also tixiCloseDocument and having intermediate saves in a long simulation run is a valid use case.

Thanks @CLiersch for pointing this out.

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