Skip to content

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

@joergbrech

Description

@joergbrech

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions