Skip to content

Commit 08450e9

Browse files
author
arch
committed
add workaround to not crash application in generator mode
1 parent 8f29769 commit 08450e9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

funscript_editor/ui/opencvui.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def __init__(self, params: OpenCV_GUI_Parameters):
158158
self.preview_scaling_applied = False
159159
self.preview_image = None
160160
self.preview_image_without_scale = None
161+
cv2.startWindowThread()
161162

162163

163164
def __del__(self):
@@ -169,7 +170,12 @@ def __del__(self):
169170
def close(self):
170171
"""Close all OpenCV GUIs"""
171172
try:
172-
cv2.destroyWindow(self.window_name)
173+
self.set_background_image(np.full((1,1,1), 0, dtype=np.uint8))
174+
self.show()
175+
cv2.resizeWindow(self.window_name, 1, 1)
176+
self.show()
177+
# TODO the following break the application (core dump)
178+
# cv2.destroyWindow(self.window_name)
173179
except:
174180
pass
175181

@@ -466,7 +472,7 @@ def show(self, wait: int = 1) -> int:
466472
""" Show annotated preview image
467473
468474
Args:
469-
wait (int): waitKey time in milliseconds
475+
wait (int): waitKey time in millisecondscv2.resizeWindow("Resized_Window", 300, 700)
470476
471477
Returns:
472478
int: waitKey result

0 commit comments

Comments
 (0)