I just happened to stumble upon this problem using both codeigniter and bbpress, and the solution was to plain remove all variables settings by references, and let the plain old “=” do the job (thanks @ Cyril Janssens).
For some reason it doesn’t work if you let those references.
Edit: You also need to specify global $bbdb, global $whateverVar in your controller, or you’ll get the same errors.
Cheers!