Skip to content

Wip/jehan/windows lock file on rename v2

Alternative implementation from !746 (closed). I only changed the third commit as explained in a comment there. Basically I add a g_output_stream_set_retry_delay() function to allow various implementations of output stream to know the caller preference when non-fatal errors occur.

See !746 (closed) for context, and in particular gimp#1370 as we have people under Windows who experience random file saving failure because of cloud clients which read the original file just as glib wants to overwrite it when closing the output stream. On Windows, this triggers a ERROR_SHARING_VIOLATION or ERROR_LOCK_VIOLATION which is not supposed to be fatal (more of a "try again later" error). I also found some old Microsoft support page which was suggesting to do exactly that (retry later).

I'm sure there are other places in code where such a delay could be used (like on some network output stream with temporary failure maybe?).

It would be nice if either !746 (closed) or this alternative version could be merged. Maybe the current one is better as more generic and easier for reuse of the value (whether the other one is more focused on g_output_stream_close() only).

Merge request reports