[QGIS-Developer] Crash with QgsAuthManager() in 3.x

Nyall Dawson nyall.dawson at gmail.com
Sat Jun 2 16:14:05 PDT 2018


On 2 June 2018 at 05:39, Richard Duivenvoorde <rdmailings at duif.net> wrote:
> Hi Devs,
>
> Coding a plugin which has to retrieve json from some services with Basis
> Authentication I thought to use QgsAuthManager etc... Both to hold
> username/password AND the service url, so users decide by choosing the
> right profile which service url/username/password to use.
>
> Created a small ui for it QgsAuthConfigSelect(), and used something like:
>
> auth_man = QgsAuthManager()
> uri = auth_man.availableAuthMethodConfigs()[conf_id].uri()
>
> To search for a uri of a selected config..
>
> BUT every time QGIS crashes.
>
> To me it looks like QgsAuthManager() should(!) be a singleton, but
> isn't. And QGIS crashes in the destructing of the QgsAuthManager...
>
> Can somebody confirm? I'll create a ticket.

The docs need fixing here (I'll do that). You shouldn't be creating
your own auth manager, but instead use the manager returned by

    auth_man = QgsApplication.authManager()

Nyall


More information about the QGIS-Developer mailing list