CRITICAL FIX: Use Clock.schedule_once for thread-safe player state updates

BUG: Background upload thread was crashing the app

Problem:
  - _upload_to_server() runs in daemon thread
  - Was directly setting self.player.should_refresh_playlist from thread
  - Kivy is NOT thread-safe for direct state modifications
  - App crashed after 2-3 minutes during editing

Root cause:
  Line 503: self.player.should_refresh_playlist = True
  This directly modified Kivy object state from non-main thread
  Caused race conditions and memory corruption

Solution:
  - Use Clock.schedule_once() to schedule flag update on main thread
  - Ensures all Kivy state modifications happen on main thread
  - Thread-safe and proper Kivy API usage
  - No more app crashes during editing

This was causing the app to crash every 10-20 seconds during edits.
Should now be stable!
This commit is contained in:
Kiwy Player
2026-01-17 22:05:56 +02:00
parent 30f058182c
commit a825d299bf
7 changed files with 16 additions and 23 deletions

1
.player_heartbeat Normal file
View File

@@ -0,0 +1 @@
1768680348.358552