Ladybird: Ensure we release CoreFoundation references

Once we are done with our references to some CoreFoundation types, we
must be sure to manually release those references.
This commit is contained in:
Timothy Flynn 2023-08-23 13:00:08 -04:00 committed by Tim Flynn
parent 2d154bf90a
commit 4f563e346d
2 changed files with 4 additions and 0 deletions

View file

@ -89,6 +89,7 @@ bool CFEventLoopManager::unregister_timer(int timer_id)
if (auto timer = thread_data.timers.take(timer_id); timer.has_value()) {
CFRunLoopTimerInvalidate(*timer);
CFRelease(*timer);
return true;
}
@ -140,6 +141,8 @@ void CFEventLoopManager::register_notifier(Core::Notifier& notifier)
auto* source = CFSocketCreateRunLoopSource(kCFAllocatorDefault, socket, 0);
CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode);
CFRelease(socket);
ThreadData::the().notifiers.set(&notifier, source);
}

View file

@ -860,6 +860,7 @@ static void copy_text_to_clipboard(StringView text)
[image drawInRect:image_rect];
CGContextRestoreGState(context);
CGDataProviderRelease(provider);
CGImageRelease(bitmap_image);
[super drawRect:rect];