1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-29 16:56:40 +03:00

Fix a memory leak

This commit is contained in:
Tae Won Ha 2022-09-10 15:34:40 +02:00
parent e32fdaa284
commit 58d4ea1e5a
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 10 additions and 6 deletions

View File

@ -115,21 +115,21 @@ extension TabBar {
stack.autoPinEdge(toSuperviewEdge: .bottom)
stack.spacing = self._theme.tabSpacing
stack.postDraggingHandler = { stackView, draggedView in
self.tabs = stackView.arrangedSubviews.compactMap { $0 as? Tab<Rep> }
stack.postDraggingHandler = { [weak self] stackView, draggedView in
self?.tabs = stackView.arrangedSubviews.compactMap { $0 as? Tab<Rep> }
if let draggedTab = draggedView as? Tab<Rep>,
let indexOfDraggedTab = self.tabs.firstIndex(where: { $0 == draggedTab })
let indexOfDraggedTab = self?.tabs.firstIndex(where: { $0 == draggedTab })
{
self.reorderHandler?(
self?.reorderHandler?(
indexOfDraggedTab,
draggedTab.tabRepresentative,
self.tabs.map(\.tabRepresentative)
self?.tabs.map(\.tabRepresentative) ?? []
)
}
let endIndex = stackView.arrangedSubviews.endIndex - 1
self.tabs.enumerated().forEach { index, tab in
self?.tabs.enumerated().forEach { index, tab in
tab.position = []
if index == 0 { tab.position.insert(.first) }
if index == endIndex { tab.position.insert(.last) }

View File

@ -1,5 +1,9 @@
# Next
* Bugfix: Memory leak (custom tabs).
# 0.42.0-20220703.104316
* Add `VimRRefreshFileBrowser` and `VimRRevealCurrentBufferInFileBrowser` functions. Thanks @jaanauati for the PR!
* Include `libintl` again.