plac-for-apple-platform

Unofficial Roon client for Apple devices

core: Fix random crash on opening a page having images This patch fixes random crash caused by race condition (use after free and unexplainable memory errors such as malloc in glib,) by properly guarding accesses to image download queue. Inside `while` loop reading the downloads queue, it read without lock and that caused reading of freed memory (`d == undefined`), thus operations like `d.data.arc.ref()` and `allocator.destroy(d)` to be invalid. Because the race condition occurs on downloads queue, opening browse page with massive items (200~) has been crashed the app frequently compared to small number of items (~50). Also, longer the image takes to load, more likely the crash to happens. So streaming service's browse page is more prone to crash than local library. With this change, I don't see random crash on Qobuz pages anymore. In addition, for some mysterious reason, images load faster than before. Definetely previous implementation did something wrong, as adding a lock does not make things faster but slower... <https://codeberg.org/pocka/plac/issues/15>

Changes

1 changed files (+23/-10)