Dear list, I just notice that bv_->setCursor(makeDocIterator(it, pos)); will trigger an error if invalid pos is passed, because of externally changed lyx file. Checking the validity of pos is therefore necessary in scrollToPosition().
Please fix this problem, or I can submit another patch after my proposed patch is applied. Cheers, Bo