McRogueFace/tests/demo
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
..
ldtk LDtk import support 2026-02-07 11:34:38 -05:00
screens Test suite modernization 2026-02-09 08:15:18 -05:00
screenshots docs: Update grid demo and regenerate API docs 2025-12-02 09:21:43 -05:00
__init__.py refactor: comprehensive test suite overhaul and demo system 2025-11-25 23:37:05 -05:00
audio_synth_demo.py Fix callback/timer GC: prevent premature destruction of Python callbacks 2026-02-19 20:53:50 -05:00
cookbook_showcase.py Add cookbook and tutorial showcase demos 2026-01-15 04:06:24 +00:00
demo_main.py Timer overhaul: update tests 2026-01-03 22:44:53 -05:00
new_features_showcase.py Add cookbook and tutorial showcase demos 2026-01-15 04:06:24 +00:00
perspective_patrol_demo.py Test suite modernization 2026-02-09 08:15:18 -05:00
procgen_showcase.py Add cookbook and tutorial showcase demos 2026-01-15 04:06:24 +00:00
simple_showcase.py Add cookbook and tutorial showcase demos 2026-01-15 04:06:24 +00:00
tutorial_screenshots.py Add cookbook and tutorial showcase demos 2026-01-15 04:06:24 +00:00
tutorial_showcase.py Add cookbook and tutorial showcase demos 2026-01-15 04:06:24 +00:00
viewport3d_demo.py Viewport scene explorer + object cache integration 2026-02-04 13:44:20 -05:00
viewport3d_screenshot.py Test suite modernization 2026-02-09 08:15:18 -05:00