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) ## 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) ### 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 - 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", "plugin_manager_url": "https://github.com/bombsquad-community/plugin-manager/{content_type}/{tag}/plugin_manager.py",
"versions": { "versions": {
"1.0.4": null,
"1.0.3": { "1.0.3": {
"api_version": 8, "api_version": 8,
"commit_sha": "2a5ce50", "commit_sha": "2a5ce50",

View file

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