Fix macos memory leaks
This commit is contained in:
@@ -344,6 +344,7 @@ class AppleLiveText:
|
||||
else:
|
||||
raise ValueError(f'img_or_path must be a path or PIL.Image, instead got: {img_or_path}')
|
||||
|
||||
with objc.autorelease_pool():
|
||||
req = VKCImageAnalyzerRequest.alloc().initWithImage_requestType_(self._preprocess(img), 1) #VKAnalysisTypeText
|
||||
req.setLocales_(['ja','en'])
|
||||
self.result = None
|
||||
|
||||
@@ -36,6 +36,7 @@ except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
import objc
|
||||
from AppKit import NSData, NSImage, NSBitmapImageRep, NSDeviceRGBColorSpace, NSGraphicsContext, NSZeroPoint, NSZeroRect, NSCompositingOperationCopy
|
||||
except ImportError:
|
||||
pass
|
||||
@@ -682,6 +683,7 @@ def run(read_from=None,
|
||||
win32clipboard.CloseClipboard()
|
||||
elif mac_clipboard_polling:
|
||||
if not paused:
|
||||
with objc.autorelease_pool():
|
||||
old_count = count
|
||||
count = pasteboard.changeCount()
|
||||
if not just_unpaused and count != old_count and NSPasteboardTypeTIFF in pasteboard.types():
|
||||
|
||||
Reference in New Issue
Block a user