GpgME::Context::engineInfo() returns an EngineInfo object created for gpgme_ctx_get_engine_info(d->ctx) which does not return a pointer to the engine info corresponding to the protocol used for d->ctx but a pointer to the first entry of the linked list of engine infos.
As collateral damage, Context::setEngineFileName() overwrites the home directory entry of the context's engine with the home directory of the first engine and vice versa for Context::setEngineHomeDirectory().