cancel
Showing results for 
Search instead for 
Did you mean: 

Bug: CacheableContainer::cachedBitmapId is not initialized by constructor

Klemens_Pleiner_STE
Associate III

Hi,

I came across the missing implementation of CacheableContainer::cachedBitmapId in the following situation:

  • My application starts with a screen where CacheableContainers are used. This first time everything works fine.
  • Then the application switches to another screen.
  • The other screen switches back to the first screen with the CacheableContainers. Now nothing is displayed for the CacheableContainers :(

First I thought the problem is caused somewhere in my code. But I could not find any bug in my code. Then I reviewed the CacheableContainer sources and bingo:

When a screen is placed in a portion of memory that was used to house another screen, the private member CacheableContainer::cachedBitmapId might not be initialized as expected.

This bug is solved by calling setCacheBitmap(BITMAP_INVALID) in the constructor of the first screen. (The source of CacheableContainer.hpp and .cpp led me to this fix.)

=> Could you please add a constructor to CacheableContainer and initialize all members which are introduced in CacheableContainer to default values that let the CacheableContainer work correctly?

Thanks & kind regards,

Klemens Pleiner

7 REPLIES 7
Martin KJELDSEN
Chief III

Hi Klemens!

Thanks for investigating, i'll look into it. Do you have a small project that shows the issue i can look at?

/Martin

Romain DIELEMAN
ST Employee

Hi Klemens,

Could you also add this input to the "idea zone" section of this forum ? This will help us track it and forward it internally.

/Romain

Hi Martin,

I'm sorry, I've no small project that demonstrates the problem. If you really need one, I'd have to create on that does the following:

  • Enter a page where a CacheableContainer is used.
  • Enter another page that uses that bit of memory where the CacheableContainer resided in. This new page must set that region of memory to 0 where cachedBitmapId resided.
  • Return to the first Screen. CacheableContainer::cachedBitmapId is not initialized and thus it uses the value 0.

Just tell me, if you really need such an example.

KR, Klemens

​Please do! Thanks :)

Martin, here you are:

The SupportDemo contains two screens. A button on each screen switches to the other screen.

If you compile it like it is contained in the zip archive, you will not see the button on Screen1 anymore when you return from Screen2.

If you comment the lines 24-28 in Screen2View.hpp, the side effect will NOT happen and Screen1 always displays the button (even when returning from Screen2).

Screen2View::buffer[1736] is exactly the spot in memory where Screen1ViewBase::cacheableContainer will live later on.

Any more explanations needed?

​Thanks, Klemens. Downloaded. I'll check it out!