vgmoose / wiiu-hbas

[Wii U] Homebrew App Store - download apps for HBL (Legacy)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Major Icon Problems

vgmoose opened this issue · comments

When you launch HBAS 1.0, it downloads all the icons asynchronously, and populates them in their buttons.

It seems if you try to click an app button while it's still loading these icons, the new window will freeze, the music will keep playing, and the app will be soft-locked.

This bug has become more apparent now that there are more homebrew apps out for Wii U.

I completely refactored how the app buttons and icon loading works in fortheusers/hb-appstore@dc6d4af, however it seems the SAME bug occurs!

What's interesting is everything is fine once the populateIconCache thread ends. It makes me feel like something needs to be flushed or something so that the thread can safely access the downloaded data.

Even stranger, it only seems to happen if:

  1. An image is downloaded
  2. That image is set to a GuiImage for one of the buttons
  3. The thread hasn't ended yet

In other words, it's okay to do any of those three things, and it won't crash, but only when all three are combined does it crash.

For example, it doesn't crash if the icons are all downloading, the thread is running, but the image is set to a predefined resource (doesn't meet criteria 2).

Possible workarounds on this issue are to implement #6 (caching), and maybe downloading to disk and displaying would be safer.

Okay, after more digging:

I discovered that the pop up window no longer crashes if I remove the description text from the pop up screen upon clicking an icon. The description is set to WRAP, changing it something else fixes the error, but then prevents the description from rendering properly.

After putting logs in the wrapping code in GuiText.cpp, the pop up transition slowed down (due to sending data over UDP) and then it didn't crash. So, I'm guessing there's a race condition there, and something funky with memory is going on...

To sidestep the problem, I've pushed e5b651e, which caches icons to SD at launch, and no longer fetches them in the background. This incurs a longer wait time for the first run, but faster successive ones.