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: 
bbrouse
Visitor

Player Crash when function named onSubmitButtonSelected

I don't know if this is an isolated problem, or if I'm just crazy, but I ran into a very strange issue today while developing a scene.

I have a scene that is structured like all my others that work just fine. I have my brightscript code embedded into the xml file itself rather than splitting them up. I added some functions for handling button logic to the scene, packaged it up, and deployed it to my local Roku player.

The debugger shows the normal:
------ Compiling dev 'channelname' ------


Once that displays in the debugger there's no other output and the player freezes and doesn't accept remote input, doesn't respond to external control commands; the splash screen for the channel doesn't even display. When I restart the player the Roku logo appears then goes into a black screen. I let it sit for 30 minutes a couple times but the main menu failed to load. I had to do a factory reset to get the player to boot properly again.

After some debugging I narrowed the problem down to the name of one of my button handler functions:
onSubmitButtonSelected


If I change the name of the function the channel runs fine. I thought maybe I had another function somewhere with the same name and that caused some kind of collision during compilation, but I don't.

Anyone have ideas what was happening here? Is there a global built-in function named onSubmitButtonSelected? I tried to see if that was the case but couldn't find any answers.
0 Kudos
6 REPLIES 6
EnTerr
Roku Guru

Re: Player Crash when function named onSubmitButtonSelected

For the record, can you give model# and firmware#?

Ha! Am i getting this right - you are saying that changing onSubmitButtonSelected to onSubmitButtonSelected1 fixes the problem - and changing it back makes it disappear?
(Best if you can do this as clean room experiment, i.e. repeating above - change only the name to literally onSubmitButtonSelected1 and try, then literally change only to onSubmitButtonSelected and try)

A reserved word would have caused syntax error, where a global function would've silently overridden yours.
0 Kudos
bbrouse
Visitor

Re: Player Crash when function named onSubmitButtonSelected

Both players had the same model/firmware:
Model: 4230X - Roku 3
Firmware: version 7.1.0 build 4061-04

I performed the test you proposed and saw the behavior I had been seeing all day: onSubmitButtonSelected caused a freeze/crash, onSubmitButtonSelected1 launched just fine.
0 Kudos
EnTerr
Roku Guru

Re: Player Crash when function named onSubmitButtonSelected

Wow, that seems like a splendiferous bug to discover! :twisted:
Considering you report it leaving the player dead beyond reboot - and in need of factory reset.

Can you assemble a minimal example, say something you can post as [ code] ... [/code] here - i can try it on my player too. There is better chance for Roku* to pay attention if the issue is confirmed by a 3rd party
0 Kudos
RokuRobB
Streaming Star

Re: Player Crash when function named onSubmitButtonSelected

It would be helpful to see the original sample. I just created the sample below with no issues:

SimpleButtonScene.xml

<?xml version="1.0" encoding="utf-8" ?>
<!--********** Copyright 2016 Roku Corp. All Rights Reserved. **********-->


<component name="SimpleButtonScene" extends="Scene" >

<script type="text/brightscript" uri="pkg:/components/SimpleButtonScene.brs" />

<children>
<Group id="myGroup">
<Button id="button" text="Press Me!" translation="[100, 100]" />
<Button id="button1" text="Button 1" translation="[100, 160]" />
<Label id="myLabel" text="Test label" vertAlign="center" horizAlign="center" translation="[400, 100]" />
</Group>
</children>

</component>

SimpleButtonScene.brs


'********** Copyright 2016 Roku Corp. All Rights Reserved. **********

function init()
m.button= m.top.findNode("button")
m.button1 = m.top.findNode("button1")
m.button.ObserveField("buttonSelected", "onButtonSelected")
m.button1.ObserveField("buttonSelected", "onSubmitButtonSelected")
m.button.SetFocus(true)
m.label = m.top.FindNode("myLabel")
end function

function onButtonSelected() as void
m.label.text = "Button Pressed"
end function

function onSubmitButtonSelected() as void
m.label.text = "Button1 Pressed"
end function

function onKeyEvent(key as String, press as Boolean) as Boolean
handled = false
if press then
if (key = "down") then
if (m.button.hasFocus())
m.button1.setFocus(true)
else
m.button.setFocus(true)
end if
handled = true
else if (key = "up")
if (m.button1.hasFocus())
m.button.setFocus(true)
else
m.button1.setFocus(true)
end if
handled = true
end if
end if
return handled
end function
0 Kudos
bbrouse
Visitor

Re: Player Crash when function named onSubmitButtonSelected

Here's a gist to the code for the WIP scene in question: https://gist.github.com/bbrouse/ded69da63b3306ffb76c4420b6e60ea4

This is the working code; the function in question has been changed to submitButtonSelected()

BaseScene is just a scene component that handles loading some data into each of our scenes (user data, config, etc.)
0 Kudos
Veeta
Visitor

Re: Player Crash when function named onSubmitButtonSelected

I'm seeing this same behavior, though I haven't been able to narrow down to a single function name. I don't have a "onSubmitButtonSelected" function, but i have some interfaces with xxxButtonSelected fields. Hopefully I can narrow this down but it's a very long debug cycle having to reset my Roku 4 each time.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.