forked from shadowfacts/Tusker
Fix memory leak in attachment container view
This commit is contained in:
parent
b80a61cc95
commit
42f9d19ee9
|
@ -58,11 +58,11 @@ class AttachmentsContainerView: UIView {
|
||||||
attachmentViews.removeAllObjects()
|
attachmentViews.removeAllObjects()
|
||||||
moreView?.removeFromSuperview()
|
moreView?.removeFromSuperview()
|
||||||
|
|
||||||
|
var accessibilityElements = [Any]()
|
||||||
|
|
||||||
if attachments.count > 0 {
|
if attachments.count > 0 {
|
||||||
self.isHidden = false
|
self.isHidden = false
|
||||||
|
|
||||||
var accessibilityElements = [Any]()
|
|
||||||
|
|
||||||
switch attachments.count {
|
switch attachments.count {
|
||||||
case 1:
|
case 1:
|
||||||
let attachmentView = createAttachmentView(index: 0, hSize: .full, vSize: .full)
|
let attachmentView = createAttachmentView(index: 0, hSize: .full, vSize: .full)
|
||||||
|
@ -215,13 +215,16 @@ class AttachmentsContainerView: UIView {
|
||||||
accessibilityElements.append(topRight)
|
accessibilityElements.append(topRight)
|
||||||
accessibilityElements.append(bottomLeft)
|
accessibilityElements.append(bottomLeft)
|
||||||
accessibilityElements.append(moreView)
|
accessibilityElements.append(moreView)
|
||||||
}
|
|
||||||
|
|
||||||
self.accessibilityElements = accessibilityElements
|
}
|
||||||
} else {
|
} else {
|
||||||
self.isHidden = true
|
self.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure accessibilityElements is set every time the UI is updated, otherwise it holds
|
||||||
|
// on to strong references to the old set of attachment views
|
||||||
|
self.accessibilityElements = accessibilityElements
|
||||||
|
|
||||||
contentHidden = Preferences.shared.blurAllMedia || status.sensitive
|
contentHidden = Preferences.shared.blurAllMedia || status.sensitive
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue