Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix #8268: UIGraphicsBeginImageContextWithOptions causing Intermittent crash while taking Tab Screenshot #8269

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Sources/Brave/Extensions/UIViewExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ extension UIView {

let offset = offset ?? .zero

// Temporary check to handle _UIGraphicsBeginImageContextWithOptions zero size error
// Shiould be replaced with UIGraphicsImageRenderer
if size.width <= 0 || size.height <= 0 {
iccub marked this conversation as resolved.
Show resolved Hide resolved
return nil
}

UIGraphicsBeginImageContextWithOptions(size, false, UIScreen.main.scale * quality)
drawHierarchy(in: CGRect(origin: offset, size: frame.size), afterScreenUpdates: false)
let image = UIGraphicsGetImageFromCurrentImageContext()
Expand Down