Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
TheEndless
Channel Surfer

[SDK Bug : 3.0 : Reproducible] roRegion from roRegion

I've discovered a bug in the 3.0 SDK that causes the box to crash and reboot...

If you create an roRegion component from another roRegion component, then call DrawObject on the new roRegion, the box will crash and reboot. This is obviously simplified to illustrate the issue, but the following code will reproduce the issue:
screen = CreateObject("roScreen")
' Create a 100x100 white square bitmap
bitmap = CreateObject("roBitmap", { Width:100, Height: 100, AlphaEnable: False })
bitmap.Clear(&HFFFFFFFF)

' Create a region for the bitmap
region = CreateObject("roRegion", bitmap, 0, 0, bitmap.GetWidth(), bitmap.GetHeight())

' Create a second region from the previous region. This should probably fail, but does not.
region2 = CreateObject("roRegion", region, 0, 0, region.GetWidth(), region.GetHeight())

' This line will crash the box
screen.DrawObject(0, 0, region2)

The workaround (correct way to do this?) is to create the second region using the GetBitmap() method of the first region:
' Create a second region from the previous region's bitmap.
region2 = CreateObject("roRegion", region.GetBitmap(), 0, 0, region.GetWidth(), region.GetHeight())
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos