Commit c3485caf authored by Philipp Hörist's avatar Philipp Hörist

Pass data to the callback when calling write_all_async()

- Fix indentation
parent 587cec9e
......@@ -1756,16 +1756,18 @@ def _on_file_created(file, result, user_data):
outputstream = file.create_finish(result)
except GLib.Error as error:
callback(False, error, user_data)
# Pass data as user_data to the callback, because
# write_all_async() takes not reference to the data
# and python gc collects it before the data are written
(callback, user_data))
(callback, data, user_data))
def _on_write_finished(outputstream, result, user_data):
callback, user_data = user_data
callback, _data, user_data = user_data
successful, _bytes_written = outputstream.write_all_finish(result)
except GLib.Error as error:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment