McRogueFace/tests/regression
John McCardle 9718153709 Fix callback/timer GC: prevent premature destruction of Python callbacks
closes #251

Two related bugs where Python garbage collection destroyed callbacks
that were still needed by live C++ objects:

1. **Drawable callbacks (all 8 types)**: tp_dealloc unconditionally called
   click_unregister() etc., destroying callbacks even when the C++ object
   was still alive in a parent's children vector. Fixed by guarding with
   shared_ptr::use_count() <= 1 — only unregister when the Python wrapper
   is the last owner.

2. **Timer GC prevention**: Active timers now hold a Py_INCREF'd reference
   to their Python wrapper (Timer::py_wrapper), preventing GC while the
   timer is registered in the engine. Released on stop(), one-shot fire,
   or destruction. mcrfpy.Timer("name", cb, 100) now works without storing
   the return value.

Also includes audio synth demo UI fixes: button click handling (don't set
on_click on Caption children), single-column slider layout, improved
Animalese contrast.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 20:53:50 -05:00
..
issue_9_rendertexture_resize_test.py Test suite modernization 2026-02-09 08:15:18 -05:00
issue_37_simple_test.py update tests: new scene API 2026-01-03 10:59:52 -05:00
issue_76_test.py Test suite modernization 2026-02-09 08:15:18 -05:00
issue_79_color_properties_test.py Test suite modernization 2026-02-09 08:15:18 -05:00
issue_99_texture_font_properties_test.py Test suite modernization 2026-02-09 08:15:18 -05:00
issue_123_chunk_system_test.py Test suite modernization 2026-02-09 08:15:18 -05:00
issue_146_fov_returns_none.py Test suite modernization 2026-02-09 08:15:18 -05:00
issue_147_grid_layers.py Test suite modernization 2026-02-09 08:15:18 -05:00
issue_148_layer_dirty_flags.py Test suite modernization 2026-02-09 08:15:18 -05:00
issue_176_entity_position_test.py Test suite modernization 2026-02-09 08:15:18 -05:00
issue_177_gridpoint_grid_pos_test.py Test suite modernization 2026-02-09 08:15:18 -05:00
issue_179_181_grid_vectors_test.py Organize test suite: add README, move loose tests to proper directories 2026-01-21 21:34:22 -05:00
issue_180_timer_orphan_test.py Organize test suite: add README, move loose tests to proper directories 2026-01-21 21:34:22 -05:00
issue_180_timer_stopped_test.py Organize test suite: add README, move loose tests to proper directories 2026-01-21 21:34:22 -05:00
issue_182_caption_size_test.py Organize test suite: add README, move loose tests to proper directories 2026-01-21 21:34:22 -05:00
issue_183_parent_quirks_test.py tests for the last few issues (these test scripts should work with recent APIs, while the rest of the test suite needs an overhaul) 2026-01-08 10:31:21 -05:00
issue_184_189_module_test.py Organize test suite: add README, move loose tests to proper directories 2026-01-21 21:34:22 -05:00
issue_185_188_bounds_test.py Organize test suite: add README, move loose tests to proper directories 2026-01-21 21:34:22 -05:00
issue_190_layer_docs_test.py Test suite modernization 2026-02-09 08:15:18 -05:00
issue_212_to_217_test.py Add input validation and fix Entity repr 2026-01-16 19:18:27 -05:00
issue_223_clip_children_test.py Fix UIFrame RenderTexture positioning and toggling issues 2026-01-22 22:54:50 -05:00
issue_251_callback_gc_test.py Fix callback/timer GC: prevent premature destruction of Python callbacks 2026-02-19 20:53:50 -05:00
issue_251_timer_gc_test.py Fix callback/timer GC: prevent premature destruction of Python callbacks 2026-02-19 20:53:50 -05:00
issue_callback_refcount_test.py Simplify on_enter/on_exit callbacks to position-only signature 2026-01-28 17:36:02 -05:00
recursive_animation_callback_segfault.py fix: animations modifying animations during callback is now safe 2026-02-04 10:25:59 -05:00
subclass_callback_segfault_test.py Fix: Derivable drawable types participate in garbage collector cycle detection 2026-01-27 13:21:10 -05:00
test_type_preservation_solution.py Test suite modernization 2026-02-09 08:15:18 -05:00