Skip to content

Commit dc01a22

Browse files
committed
Fix crash caused by incorrect sizer clearing
1 parent 8b21f23 commit dc01a22

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

backdrop.py

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ def display_backup_summary_chunk(title: str, payload: list, reset: bool = None):
229229
reset = False
230230

231231
if reset:
232-
for child in summary_summary_sizer.GetChildren():
233-
child.GetWindow().Destroy()
232+
summary_summary_sizer.Clear(True)
233+
summary_summary_sizer.Layout()
234234

235235
heading_label = wx.StaticText(summary_summary_panel, -1, label=title, name='Backup summary chunk header label')
236236
heading_label.SetFont(FONT_HEADING)
@@ -315,7 +315,8 @@ def display_backup_command_info(display_command_list: list) -> list:
315315

316316
global cmd_info_blocks
317317

318-
summary_details_sizer.Clear()
318+
summary_details_sizer.Clear(True)
319+
summary_details_sizer.Layout()
319320

320321
cmd_info_blocks = []
321322
for i, item in enumerate(display_command_list):
@@ -375,10 +376,10 @@ def backup_reset_ui():
375376
backup_error_log.clear()
376377

377378
# Empty backup summary and detail panes
378-
for child in summary_summary_sizer.GetChildren():
379-
child.GetWindow().Destroy()
380-
for child in summary_details_sizer.GetChildren():
381-
child.GetWindow().Destroy()
379+
summary_summary_sizer.Clear(True)
380+
summary_summary_sizer.Layout()
381+
summary_details_sizer.Clear(True)
382+
summary_details_sizer.Layout()
382383

383384
# Clear file lists for file details pane
384385
for list_name in file_detail_list.keys():
@@ -402,10 +403,10 @@ def backup_reset_ui():
402403
file_details_failed_header_sizer.Layout()
403404

404405
# Empty file details list panes
405-
for child in file_details_success_sizer.GetChildren():
406-
child.GetWindow().Destroy()
407-
for child in file_details_failed_sizer.GetChildren():
408-
child.GetWindow().Destroy()
406+
file_details_success_sizer.Clear(True)
407+
file_details_success_sizer.Layout()
408+
file_details_failed_sizer.Clear(True)
409+
file_details_failed_sizer.Layout()
409410

410411

411412
def request_kill_analysis():
@@ -626,10 +627,10 @@ def change_source_drive(e):
626627
def reset_analysis_output():
627628
"""Reset the summary panel for running an analysis."""
628629

629-
for child in summary_summary_sizer.GetChildren():
630-
child.GetWindow().Destroy()
631-
for child in summary_details_sizer.GetChildren():
632-
child.GetWindow().Destroy()
630+
summary_summary_sizer.Clear(True)
631+
summary_summary_sizer.Layout()
632+
summary_details_sizer.Clear(True)
633+
summary_details_sizer.Layout()
633634

634635
summary_summary_sizer.Add(wx.StaticText(summary_summary_panel, -1, label="This area will summarize the backup that's been configured.", name='Backup summary placeholder tooltip 1'), 0)
635636
summary_summary_sizer.Add(wx.StaticText(summary_summary_panel, -1, label='Please start a backup analysis to generate a summary.', name='Backup summary placeholder tooltip 2'), 0, wx.TOP, 5)
@@ -1333,8 +1334,10 @@ def start_backup():
13331334
file_details_failed_header_sizer.Layout()
13341335

13351336
# Empty file details list panes
1336-
file_details_success_sizer.Clear()
1337-
file_details_failed_sizer.Clear()
1337+
file_details_success_sizer.Clear(True)
1338+
file_details_success_sizer.Layout()
1339+
file_details_failed_sizer.Clear(True)
1340+
file_details_failed_sizer.Layout()
13381341

13391342
if not backup.analysis_valid or not backup.sanity_check():
13401343
return
@@ -1501,8 +1504,10 @@ def recurse_for_hash(path: str, drive: str, hash_file_path: str):
15011504
file_details_failed_header_sizer.Layout()
15021505

15031506
# Empty file details list panes
1504-
file_details_success_sizer.Clear()
1505-
file_details_failed_sizer.Clear()
1507+
file_details_success_sizer.Clear(True)
1508+
file_details_success_sizer.Layout()
1509+
file_details_failed_sizer.Clear(True)
1510+
file_details_failed_sizer.Layout()
15061511

15071512
verification_running = True
15081513
verification_failed_list = []
@@ -1647,7 +1652,8 @@ def show_update_window(update_info: dict):
16471652
if update_info and 'download' in update_info.keys():
16481653
download_map = {url.split('/')[-1].lower(): url for url in update_info['download']}
16491654

1650-
update_icon_sizer.Clear()
1655+
update_icon_sizer.Clear(True)
1656+
update_icon_sizer.Layout()
16511657

16521658
icon_count = 0
16531659
for file_type, info in icon_info.items():
@@ -2107,7 +2113,8 @@ def show_backup_error_log():
21072113
# TODO: Move this error log building to the UI update function.
21082114
# This would let the UI update thread handle appending, and have this function
21092115
# only deal with showing the window itself.
2110-
backup_error_log_log_sizer.Clear()
2116+
backup_error_log_log_sizer.Clear(True)
2117+
backup_error_log_log_sizer.Layout()
21112118

21122119
for error in backup_error_log:
21132120
error_summary_block = DetailBlock(

0 commit comments

Comments
 (0)