How do I resolve a random exceptions that occur in PDFViewCtrl?

Q: We are experiencing an issue when opening PDFs in the PDFViewCtrl.
We get random errors which are not fully predictable. We are using
PDFViewCtrl to open and programmatically fill-in a PDF form.
A: the problem is most likely due to threading issues. Essentially
both rendering thread (PDFViewCtrl) and your application code (Form
field extraction/manipulation) are trying to access the PDFDoc at the
same time. Because PDFNet is loading the file incrementally (for
efficiency) this could lead to threading issues. To resolve the
problem simply surround and code that can access document which is
shown in PDFViewCtrl using doc.Lock()/Unlock().

…. Access of manipulate the doc. e.g.
FieldIterator flitter = pdfViewer.GetDoc().GetFieldIterator();
while (flitter.HasNext()) {