mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-17 14:28:47 +00:00
fix(core): preallocate save_screen_directory
to allow heap checking
Otherwise, free heap memory will decrease after handling `DebugLinkRecordScreen`. [no changelog]
This commit is contained in:
parent
bd9d303310
commit
a787d21b3f
@ -47,7 +47,7 @@ if __debug__:
|
|||||||
# Starting with "refresh00", allowing for 100 emulator restarts
|
# Starting with "refresh00", allowing for 100 emulator restarts
|
||||||
# without losing the order of the screenshots based on filename.
|
# without losing the order of the screenshots based on filename.
|
||||||
display.save(
|
display.save(
|
||||||
storage.save_screen_directory + f"/refresh{REFRESH_INDEX:0>2}-"
|
f"{storage.save_screen_directory.decode()}/refresh{REFRESH_INDEX:0>2}-"
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@ -298,7 +298,7 @@ if __debug__:
|
|||||||
# so that the screenshots are not overwritten.
|
# so that the screenshots are not overwritten.
|
||||||
global REFRESH_INDEX
|
global REFRESH_INDEX
|
||||||
REFRESH_INDEX = msg.refresh_index
|
REFRESH_INDEX = msg.refresh_index
|
||||||
storage.save_screen_directory = msg.target_directory
|
storage.save_screen_directory[:] = msg.target_directory.encode()
|
||||||
storage.save_screen = True
|
storage.save_screen = True
|
||||||
|
|
||||||
# force repaint current layout, in order to take an initial screenshot
|
# force repaint current layout, in order to take an initial screenshot
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
from trezorutils import halt
|
from trezorutils import EMULATOR, halt
|
||||||
|
|
||||||
if not __debug__:
|
if not __debug__:
|
||||||
halt("Debugging is disabled")
|
halt("Debugging is disabled")
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
save_screen = False
|
save_screen = False
|
||||||
save_screen_directory = "."
|
if EMULATOR:
|
||||||
|
save_screen_directory = bytearray(4096)
|
||||||
|
save_screen_directory[:] = b"."
|
||||||
|
|
||||||
layout_watcher = False
|
layout_watcher = False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user