Skip to content

Conversation

@City-busz
Copy link
Contributor

Instead of spawning subprocess, use GIO for the copy operation, and use a unique file name for the temporary file. Also, delete the temporary file when the document is closed.

Instead of spawning subprocess, use GIO for the copy operation, and use a
unique file name for the temporary file. Also, delete the temporary file
when the document is closed.
Copy link
Owner

@Diego-Ivan Diego-Ivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for checking this out! I removed the GIO uses here because of a weird bug, but I totally forgot about it later. I just tested this locally and it works perfectly. Just some minor adjustments and this would be good to go!

if (!success) {
critical ("Processed failed");
try {
tmp_file = GLib.File.new_tmp ("pdf-metadata-editor-XXXXXX.pdf", out stream);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use GLib.File.new_tmp_async instead.

} catch (Error e) {
throw new IOError.FAILED (@"Failed to copy file to temporary location: %s", e.message);
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should close the stream using stream.close_async. I'm not sure if closing it before freeing it is the default behaviour, but we better be cautious :)

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

Successfully merging this pull request may close these issues.

2 participants