Skip to content

Commit

Permalink
Fix crash caused by incorrect sizer clearing
Browse files Browse the repository at this point in the history
  • Loading branch information
TechGeek01 committed Jul 18, 2023
1 parent 8b21f23 commit dc01a22
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions backdrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ def display_backup_summary_chunk(title: str, payload: list, reset: bool = None):
reset = False

if reset:
for child in summary_summary_sizer.GetChildren():
child.GetWindow().Destroy()
summary_summary_sizer.Clear(True)
summary_summary_sizer.Layout()

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

global cmd_info_blocks

summary_details_sizer.Clear()
summary_details_sizer.Clear(True)
summary_details_sizer.Layout()

cmd_info_blocks = []
for i, item in enumerate(display_command_list):
Expand Down Expand Up @@ -375,10 +376,10 @@ def backup_reset_ui():
backup_error_log.clear()

# Empty backup summary and detail panes
for child in summary_summary_sizer.GetChildren():
child.GetWindow().Destroy()
for child in summary_details_sizer.GetChildren():
child.GetWindow().Destroy()
summary_summary_sizer.Clear(True)
summary_summary_sizer.Layout()
summary_details_sizer.Clear(True)
summary_details_sizer.Layout()

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

# Empty file details list panes
for child in file_details_success_sizer.GetChildren():
child.GetWindow().Destroy()
for child in file_details_failed_sizer.GetChildren():
child.GetWindow().Destroy()
file_details_success_sizer.Clear(True)
file_details_success_sizer.Layout()
file_details_failed_sizer.Clear(True)
file_details_failed_sizer.Layout()


def request_kill_analysis():
Expand Down Expand Up @@ -626,10 +627,10 @@ def change_source_drive(e):
def reset_analysis_output():
"""Reset the summary panel for running an analysis."""

for child in summary_summary_sizer.GetChildren():
child.GetWindow().Destroy()
for child in summary_details_sizer.GetChildren():
child.GetWindow().Destroy()
summary_summary_sizer.Clear(True)
summary_summary_sizer.Layout()
summary_details_sizer.Clear(True)
summary_details_sizer.Layout()

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)
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)
Expand Down Expand Up @@ -1333,8 +1334,10 @@ def start_backup():
file_details_failed_header_sizer.Layout()

# Empty file details list panes
file_details_success_sizer.Clear()
file_details_failed_sizer.Clear()
file_details_success_sizer.Clear(True)
file_details_success_sizer.Layout()
file_details_failed_sizer.Clear(True)
file_details_failed_sizer.Layout()

if not backup.analysis_valid or not backup.sanity_check():
return
Expand Down Expand Up @@ -1501,8 +1504,10 @@ def recurse_for_hash(path: str, drive: str, hash_file_path: str):
file_details_failed_header_sizer.Layout()

# Empty file details list panes
file_details_success_sizer.Clear()
file_details_failed_sizer.Clear()
file_details_success_sizer.Clear(True)
file_details_success_sizer.Layout()
file_details_failed_sizer.Clear(True)
file_details_failed_sizer.Layout()

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

update_icon_sizer.Clear()
update_icon_sizer.Clear(True)
update_icon_sizer.Layout()

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

for error in backup_error_log:
error_summary_block = DetailBlock(
Expand Down

0 comments on commit dc01a22

Please sign in to comment.