Forum Discussion

johnmarsden's avatar
8 years ago

Hilarious Roku bug of the day: .delete(xyz)

I found that using
listObject.delete(index)


wasn't working 100% as expected. If I tried to access objects in there later, the list didn't shift.. or something. Not sure what exactly happens behind the scenes, but it wasn't working correctly.

I would delete index #1 at some point.. then add another.. then try to access listObject[1], which would always crash; consistently.

Then I tried debugging it by doing:


listObject.delete(index)
print listObject


and it would print the object out as expected... but also, it didn't break anymore. 
This is 100% consistent. I tested multiple times, multiple scenarios, with and without the print log. I did it with the debugger on and off. 
When the print command was commented out... it crashed. 
When the print command was uncommented... it worked. 
Every. Single. Time.

5 Replies

  • Also tried a variety of these mixtures:

    listObject.delete(index);

    ' listObject = listObject   FAIL
    ' print listObject.peek()   FAIL
    ' print listObject.count()   FAIL
    ' print listObject[0]       WORKS
    ' print listObject           WORKS
    ' print listObject.resetIndex() WORKS


    Shaking my head in disbelief. 
  • schrodingers cat?  it only resolves when you force it to by looking at it first.
  • my naive attempt to repro failed. not even sure if that was about roList or else.
    MWE, please?
  • "RokuNB" wrote:
    my naive attempt to repro failed. not even sure if that was about roList or else.
    MWE, please?

    That might be pretty tough to make considering the structure. I could maybe try, but in the meantime, any thoughts on why this might be a thing?
  • RokuKC's avatar
    RokuKC
    Roku Employee
    "johnmarsden" wrote:
    "RokuNB" wrote:
    my naive attempt to repro failed. not even sure if that was about roList or else.
    MWE, please?

    That might be pretty tough to make considering the structure. I could maybe try, but in the meantime, any thoughts on why this might be a thing?

    From the APIs listed it sounds like you are referring to roList.  Are you creating the list with CreateObject, or getting it from some other source API?
    roList is not really a frequently used construct, in my experience.  Generally roArray has better capabilities for most uses.
    Are you using roList in conjunction with SceneGraph components or possibly some other unusual scenario?
    It's certainly possible that there are bugs, and if so any more detailed information you can provide would be helpful.