Improving dangling reference checks for UI objects

This commit is contained in:
Eric Froemling 2020-11-06 12:45:46 -08:00
parent eb4c335699
commit 6f0e8b68a3
8 changed files with 32 additions and 26 deletions

View File

@ -3932,24 +3932,24 @@
"assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450", "assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450",
"assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e",
"assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f",
"build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/9b/8d/abc71be4dd804f41f9e051be60b5", "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/45/dc/e839d976e8de4f76d3b54de5d797",
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9f/e6/8cea5211bff457fd4f2dd2684e4a", "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/39/a5/b43c4782cc1b4029cc37f3fdbdad",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c4/fd/53b7e7dcf98bfcbd49868078a1e9", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4a/a6/9b997730074eff9d6777710c501c",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/52/7d/748f5b96fd86d674fdd7370fb48f", "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/00/2c/2c9d82ff6c3962392f38f82ef306",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/48/9d/4fec68bd18008ac6c133f91af17b", "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/22/f6/ffbb34a757725377ff0ee50b7d54",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a9/48/c0635a7fa99b90a5803d30cba932", "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/5d/7e/3569e77c80b0a38a3cc890961fd8",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/28/97/ab92822241e0ebe96d79ea244517", "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e6/ed/96b82e2fc1e13dc278f959339939",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4e/93/f464b9446f81a53b0c6c57c06b1b", "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/27/8b/f9685e24a250fc4621bd4a54f2fe",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/e1/28/5a97709a0b5a2434e560c1dec5f9", "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ce/c9/91f4c6d5ae4c24e6b8a1abe101e7",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/77/c0/81291bab7f3778fdcb40fff7f9ae", "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a3/c5/90f0dce06938303187a1c0e553d1",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/cb/35/366af828abdc7a38c51aa6966574", "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/61/d3/57b9f6d3aa937e2b6946e8c04a95",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/98/a0/89d361514cbaf876c707ef2a6214", "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/cb/d6/6c57d5c6c62ba62b689bcb0ec2d2",
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c3/d7/627d518a92951cf7fe9fc0b9b3a0", "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c3/d7/627d518a92951cf7fe9fc0b9b3a0",
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/de/49/2cfc34ac856737d903954db5571b", "build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/de/49/2cfc34ac856737d903954db5571b",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e8/9a/67cf9ece361ca2f5d338009bdbfc", "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e8/9a/67cf9ece361ca2f5d338009bdbfc",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/de/7d9c9a2b7bba34c630130ed759c9", "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/de/7d9c9a2b7bba34c630130ed759c9",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/76/d3/07d11e5d09403307cc7ef8f4da30", "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e9/a4/5810e89715c82ca695bc274fd10a",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f0/a8/4f3f95253ba894441a2e6d1d000a", "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b2/4b/335f5a189ae793aff0f3da439804",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5a/39/d01e18dbd749f7fbf9eea1dfc234", "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9a/87/5e76ab68086ea0c2a15b53da11c0",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b5/24/c39eab10911071af84de3824a197" "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/77/f2/35f10f6ad8349e3fe9817de342f0"
} }

View File

@ -1,4 +1,4 @@
### 1.5.27 (20234) ### 1.5.27 (20238)
- Language functionality has been consolidated into a LanguageSubsystem object at ba.app.lang - Language functionality has been consolidated into a LanguageSubsystem object at ba.app.lang
- ba.get_valid_languages() is now an attr: ba.app.lang.available_languages - ba.get_valid_languages() is now an attr: ba.app.lang.available_languages
- Achievement functionality has been consolidated into an AchievementSubsystem object at ba.app.ach - Achievement functionality has been consolidated into an AchievementSubsystem object at ba.app.ach

View File

@ -354,8 +354,8 @@ def _verify_object_death(wref: ReferenceType) -> None:
print(f'Note: unable to get type name for {obj}') print(f'Note: unable to get type name for {obj}')
name = 'object' name = 'object'
print(f'{Clr.RED}Error: {name} not dying' print(f'{Clr.RED}Error: {name} not dying when expected to:'
f' when expected to: {Clr.BLD}{obj}{Clr.RST}') f' {Clr.BLD}{obj}{Clr.RST}')
print_active_refs(obj) print_active_refs(obj)

View File

@ -33,6 +33,9 @@ class Window:
def __init__(self, root_widget: ba.Widget): def __init__(self, root_widget: ba.Widget):
self._root_widget = root_widget self._root_widget = root_widget
# Complain if we outlive our root widget.
uicleanupcheck(self, root_widget)
def get_root_widget(self) -> ba.Widget: def get_root_widget(self) -> ba.Widget:
"""Return the root widget.""" """Return the root widget."""
return self._root_widget return self._root_widget

View File

@ -48,11 +48,6 @@ class NetScanner:
self._last_selected_host = host self._last_selected_host = host
def _on_activate(self, host: Dict[str, Any]) -> None: def _on_activate(self, host: Dict[str, Any]) -> None:
# Sanity check: make sure our gather window gets freed after this.
tab = self._tab()
if tab:
ba.verify_object_death(tab.window)
_ba.connect_to_party(host['address']) _ba.connect_to_party(host['address'])
def update(self) -> None: def update(self) -> None:

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND --> <!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-11-02 for Ballistica version 1.5.27 build 20238</em></h4> <h4><em>last updated on 2020-11-06 for Ballistica version 1.5.27 build 20238</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module, <p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p> which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr> <hr>

View File

@ -21,7 +21,7 @@
namespace ballistica { namespace ballistica {
// These are set automatically via script; don't change here. // These are set automatically via script; don't change here.
const int kAppBuildNumber = 20238; const int kAppBuildNumber = 20239;
const char* kAppVersion = "1.5.27"; const char* kAppVersion = "1.5.27";
// Our standalone globals. // Our standalone globals.

View File

@ -386,6 +386,14 @@ auto PythonClassInputDevice::GetButtonName(PythonClassInputDevice* self,
PythonRef args2(Py_BuildValue("(s)", bname.c_str()), PythonRef::kSteal); PythonRef args2(Py_BuildValue("(s)", bname.c_str()), PythonRef::kSteal);
PythonRef results = PythonRef results =
g_python->obj(Python::ObjID::kLstrFromJsonCall).Call(args2); g_python->obj(Python::ObjID::kLstrFromJsonCall).Call(args2);
if (!results.exists()) {
Log("Error creating Lstr from raw button name: '" + bname + "'");
PythonRef args3(Py_BuildValue("(s)", "?"), PythonRef::kSteal);
results = g_python->obj(Python::ObjID::kLstrFromJsonCall).Call(args3);
}
if (!results.exists()) {
throw Exception("Internal error creating Lstr.");
}
return results.NewRef(); return results.NewRef();
BA_PYTHON_CATCH; BA_PYTHON_CATCH;