mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
debug-viewer: Copy log files in temporaries before using them
They are mmap'ed and it gets wrong if the file is changed. There is high probablility the user will generate new logs while inspecting some logs in the same file
This commit is contained in:
parent
771f27b44b
commit
ad886c288c
1 changed files with 8 additions and 0 deletions
|
@ -20,6 +20,9 @@
|
||||||
"""GStreamer Debug Viewer GUI module."""
|
"""GStreamer Debug Viewer GUI module."""
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
|
import tempfile
|
||||||
|
import shutil
|
||||||
|
|
||||||
from bisect import bisect_right, bisect_left
|
from bisect import bisect_right, bisect_left
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -231,6 +234,7 @@ class Window (object):
|
||||||
self.logger = logging.getLogger("ui.window")
|
self.logger = logging.getLogger("ui.window")
|
||||||
self.app = app
|
self.app = app
|
||||||
|
|
||||||
|
self.tmpfile = None
|
||||||
self.dispatcher = None
|
self.dispatcher = None
|
||||||
self.info_widget = None
|
self.info_widget = None
|
||||||
self.progress_dialog = None
|
self.progress_dialog = None
|
||||||
|
@ -937,6 +941,7 @@ class Window (object):
|
||||||
if self.log_file is not None:
|
if self.log_file is not None:
|
||||||
for feature in self.features:
|
for feature in self.features:
|
||||||
feature.handle_detach_log_file(self, self.log_file)
|
feature.handle_detach_log_file(self, self.log_file)
|
||||||
|
self.tmpfile = None
|
||||||
|
|
||||||
if filename is None:
|
if filename is None:
|
||||||
if self.dispatcher is not None:
|
if self.dispatcher is not None:
|
||||||
|
@ -945,6 +950,9 @@ class Window (object):
|
||||||
self.log_file = None
|
self.log_file = None
|
||||||
self.actions.groups["RowActions"].props.sensitive = False
|
self.actions.groups["RowActions"].props.sensitive = False
|
||||||
else:
|
else:
|
||||||
|
self.tmpfile = tempfile.NamedTemporaryFile()
|
||||||
|
shutil.copyfile(filename, self.tmpfile.name)
|
||||||
|
filename = self.tmpfile.name
|
||||||
self.logger.debug("setting log file %r", filename)
|
self.logger.debug("setting log file %r", filename)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue