Call to a member function setState() on bool