Skip to content

Commit

Permalink
#2617 do save-graph IO in a separate thread
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@25486 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 4, 2020
1 parent ca588d8 commit bfd30be
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/xpra/client/gtk_base/session_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -1198,8 +1198,14 @@ def save_graph(self, _ebox, btn, graph):
filename = filenames[0]
surface = graph.surface
log("saving surface %s to %s", surface, filename)
with open(filename, "wb") as f:
surface.write_to_png(f)
from io import BytesIO
b = BytesIO()
surface.write_to_png(b)
def save_file():
with open(filename, "wb") as f:
f.write(b.getvalue())
from xpra.make_thread import start_thread
start_thread(save_file, "save-graph")
elif response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.CLOSE, Gtk.ResponseType.DELETE_EVENT):
log("closed/cancelled")
else:
Expand Down

0 comments on commit bfd30be

Please sign in to comment.