Fix a memory leak

This commit is contained in:
Rikko 2023-12-08 23:44:14 +05:30
parent 8ce09ea0a3
commit 94abe80e3a
No known key found for this signature in database
3 changed files with 17 additions and 9 deletions

View file

@ -1,5 +1,10 @@
## Plugin Manager (dd-mm-yyyy)
### 1.0.4 (08-12-2023)
- Fix a few UI warnings related to 1.7.30.
- Fix a memory leak.
### 1.0.3 (06-10-2023)
- Add a compatibility layer for older builds for API deprecation changes that occured in https://github.com/efroemling/ballistica/blob/master/CHANGELOG.md#1727-build-21282-api-8-2023-08-30

View file

@ -1,6 +1,7 @@
{
"plugin_manager_url": "https://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugin_manager.py",
"versions": {
"1.0.4": null,
"1.0.3": {
"api_version": 8,
"commit_sha": "2a5ce50",

View file

@ -30,7 +30,7 @@ from threading import Thread
import logging
PLUGIN_MANAGER_VERSION = "1.0.3"
PLUGIN_MANAGER_VERSION = "1.0.4"
REPOSITORY_URL = "https://github.com/bombsquad-community/plugin-manager"
# Current tag can be changed to "staging" or any other branch in
# plugin manager repo for testing purpose.
@ -1604,6 +1604,7 @@ class PluginManagerWindow(bui.Window):
def _back(self) -> None:
from bauiv1lib.settings.allsettings import AllSettingsWindow
del self._last_filter_plugins
bui.containerwidget(edit=self._root_widget,
transition=self._transition_out)
bui.app.ui_v1.set_main_menu_window(
@ -1724,7 +1725,7 @@ class PluginManagerWindow(bui.Window):
autoselect=True,
maxwidth=search_bar_maxwidth,
description=filter_txt)
self._last_filter_text = None
self._last_filter_text = ""
self._last_filter_plugins = []
loop.create_task(self.process_search_term())
@ -1732,11 +1733,10 @@ class PluginManagerWindow(bui.Window):
async def process_search_term(self):
while True:
await asyncio.sleep(0.2)
if self._filter_widget:
filter_text = bui.textwidget(parent=self._root_widget, query=self._filter_widget)
else:
if not self._filter_widget:
# Search filter widget got destroyed. No point checking for filter text anymore.
return
filter_text = bui.textwidget(parent=self._root_widget, query=self._filter_widget)
if self.selected_category is None:
continue
try:
@ -1835,8 +1835,10 @@ class PluginManagerWindow(bui.Window):
raise CategoryDoesNotExist(f"{category} does not exist.")
if search_term:
def search_term_filterer(plugin): return self.search_term_filterer(plugin, search_term)
plugins = filter(search_term_filterer, category_plugins)
plugins = filter(
lambda plugin: self.search_term_filterer(plugin, search_term),
category_plugins,
)
else:
plugins = category_plugins
@ -1918,7 +1920,7 @@ class PluginManagerWindow(bui.Window):
for plugin in self._columnwidget.get_children():
plugin.delete()
self.plugins_in_current_view.clear()
self._last_filter_text = None
self._last_filter_text = ""
self._last_filter_plugins = []
async def refresh(self):