Reset array doesn't get new values

I’m having a problem in my program, every time I push a button it add to the array ledSequence and after reaching the limit of the array, he clean itself, but after that I can’t add new button input. And I don’t know what I doing wrong.

#include <ALib0.h>

AButton ButtonR(2);
AButton ButtonY(3);
AButton ButtonG(4);

const int ledPinR = 10;
const int ledPinG = 12;
const int ledPinY = 11;

int statusButtonR = 0;
int statusButtonG = 0;
int statusButtonY = 0;

int count = 0;
int ledSequence[5];

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(ledPinR, OUTPUT);
  pinMode(ledPinG, OUTPUT);
  pinMode(ledPinY, OUTPUT);

}

void getButtons(){
  if (ButtonR.changedTo(HIGH)) ledSequence[count++] = ledPinR;
  if (ButtonG.changedTo(HIGH)) ledSequence[count++] = ledPinG;
  if (ButtonY.changedTo(HIGH)) ledSequence[count++] = ledPinY;
}

void Blink(int sequenceBlink[], int count){
  static int i;
  static int x;
  taskBegin();
    for (i = 0; i < count; ++i) {
      x = i + 1; 
      
      digitalWrite(sequenceBlink[i], HIGH); // Begin Blink
      taskDelay(300); //non-blocking version of delay()
      digitalWrite(sequenceBlink[i], LOW);
      taskDelay(300); // End Blink
      
      Serial.print("sequenceBlink: "); // Begin-Debug
      Serial.print(sequenceBlink[i]);
      Serial.print(" count: ");
      Serial.print(count);
      Serial.print(" i: ");
      Serial.println(i); // End-Debug
      
      if (i >= sizeof(sequenceBlink)){   // Begin reset array
        memset(sequenceBlink, 0, 5);
      }   // End reset array
      
      if (sequenceBlink[x] == 0){ // Begin Wait for new button press 
        taskWaitFor(sequenceBlink[x] != 0);
      } // End Wait for new button press 
           
    } 
  taskEnd();
}

void loop() {
  // put your main code here, to run repeatedly:
  while(1){
    getButtons();
    Blink(ledSequence, count);
  }
}

Where does count get reset?

Also, every call to getButtons() increments count 3 times, in the second call you overrun the array,

You have a global int named count, and a passed arg named count that is given the global value... and only one place where the global value is set and that set to ZERO.

But I would be far more interested in how that taskDelay() function is non-blocking and still supposed to make the switch to LOW happen 300 (is-that-millis?) whatevers after it was switched HIGH.

      digitalWrite(sequenceBlink[i], HIGH); // Begin Blink
      taskDelay(300); //non-blocking version of delay()
      digitalWrite(sequenceBlink[i], LOW);

Does taskDelay() exit Blink() in the middle of the function? Does it clear the stack if it does?

PS:

void loop() {
  // put your main code here, to run repeatedly:
  while(1){
    getButtons();
    Blink(ledSequence, count);
  }
}

The while(1) loop in there is not needed. What do you think that loop() means?