From: Philippe Normand Date: Thu, 14 Jun 2018 17:01:54 +0000 (+0100) Subject: debug-viewer: Fix reload file action. X-Git-Tag: 1.19.3~491^2~523 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e2200d8891050f2f54e5a8b2c5c43a938a67010;p=platform%2Fupstream%2Fgstreamer.git debug-viewer: Fix reload file action. Copy the log file only we're loading a file different from the previous file. The previous version of this code was broken because the existing tmpfile was removed from disk before being copied to a new temporary file. --- diff --git a/debug-viewer/GstDebugViewer/GUI/window.py b/debug-viewer/GstDebugViewer/GUI/window.py index 7701ba6..43ed9c0 100644 --- a/debug-viewer/GstDebugViewer/GUI/window.py +++ b/debug-viewer/GstDebugViewer/GUI/window.py @@ -941,18 +941,19 @@ class Window (object): if self.log_file is not None: for feature in self.features: feature.handle_detach_log_file(self, self.log_file) - self.tmpfile = None if filename is None: if self.dispatcher is not None: self.dispatcher.cancel() self.dispatcher = None self.log_file = None + self.tmpfile = None self.actions.groups["RowActions"].props.sensitive = False else: - self.tmpfile = tempfile.NamedTemporaryFile() - shutil.copyfile(filename, self.tmpfile.name) - filename = self.tmpfile.name + if self.tmpfile and filename != self.tmpfile.name: + self.tmpfile = tempfile.NamedTemporaryFile() + shutil.copyfile(filename, self.tmpfile.name) + filename = self.tmpfile.name self.logger.debug("setting log file %r", filename) try: