Use context manager for handling G.progress_lock
Manually calling `G.progress_lock.release()` is error-prone as it's not called when an exception is raised while the lock is acquired.
This commit is contained in:
@@ -77,12 +77,11 @@ def draw_image(filepath, x, y, w, h):
|
||||
# Draw.
|
||||
|
||||
def benchmark_draw_post_pixel(arg1, arg2):
|
||||
G.progress_lock.acquire()
|
||||
progress_status = G.progress_status
|
||||
result_platform = G.result_platform
|
||||
result_stats = G.result_stats
|
||||
result_dict = G.result_dict
|
||||
G.progress_lock.release()
|
||||
with G.progress_lock:
|
||||
progress_status = G.progress_status
|
||||
result_platform = G.result_platform
|
||||
result_stats = G.result_stats
|
||||
result_dict = G.result_dict
|
||||
|
||||
ui_scale = bpy.context.user_preferences.system.ui_scale
|
||||
blf.color(font_id, 1.0, 1.0, 1.0, 1.0)
|
||||
|
Reference in New Issue
Block a user