diff options
author | Markus Fischer <ivanhoe@fiscari.de> | 2023-03-13 15:23:16 -0500 |
---|---|---|
committer | Markus Fischer <ivanhoe@fiscari.de> | 2023-03-13 15:23:16 -0500 |
commit | 312256badd60ba91ce6ccb1037459b91e8a348e4 (patch) | |
tree | a4816b50bbb5d930281380e1882c858fbf0c163e /libpurple/plugins/kwallet/purplekwallet.cpp | |
parent | f8ac72fa26dbabc5e94bdac14bd98f644a77f12e (diff) | |
download | pidgin-312256badd60ba91ce6ccb1037459b91e8a348e4.tar.gz |
fix issues with Qt application object in kwallet plugin
Use QGuiApplication instead of QCoreApplication to avoid runtime warning "Cannot use KWindowSystem without a QGuiApplication"
Provide argc and argv for QGuiApplication object as its documentation requires:
"The data referred to by argc and argv must stay valid for the entire lifetime of the QGuiApplication object. In addition, argc must be greater than zero and argv must contain at least one valid character string."
Testing Done:
* set kwallet as credential provider
* connected account with saved credentials
* disconnected credential provider externally
* created and connected new account and saved credentials
* restarted pidgin to let accounts autoconnect
Reviewed at https://reviews.imfreedom.org/r/2338/
Diffstat (limited to 'libpurple/plugins/kwallet/purplekwallet.cpp')
-rw-r--r-- | libpurple/plugins/kwallet/purplekwallet.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/libpurple/plugins/kwallet/purplekwallet.cpp b/libpurple/plugins/kwallet/purplekwallet.cpp index bce5c0e66d..1a0e225175 100644 --- a/libpurple/plugins/kwallet/purplekwallet.cpp +++ b/libpurple/plugins/kwallet/purplekwallet.cpp @@ -24,7 +24,7 @@ #include <purple.h> -#include <QCoreApplication> +#include <QGuiApplication> #include <kwallet.h> @@ -33,8 +33,12 @@ /****************************************************************************** * Globals *****************************************************************************/ -static QCoreApplication *qCoreApp = NULL; +static QGuiApplication *guiApp = NULL; static PurpleCredentialProvider *instance = NULL; +static char *argv[] = { + (char*)"purplekwallet", +}; +static int argc = G_N_ELEMENTS(argv); #define PURPLE_KWALLET_DOMAIN (g_quark_from_static_string("purple-kwallet")) #define PURPLE_KWALLET_WALLET_NAME (KWallet::Wallet::NetworkWallet()) @@ -569,10 +573,9 @@ kwallet_load(GPluginPlugin *plugin, GError **error) { purple_kwallet_provider_register_type(G_TYPE_MODULE(plugin)); - if(qCoreApp == NULL) { - int argc = 0; - qCoreApp = new QCoreApplication(argc, NULL); - qCoreApp->setApplicationName(purple_kwallet_get_ui_name()); + if(guiApp == NULL) { + guiApp = new QGuiApplication(argc, argv); + guiApp->setApplicationName(purple_kwallet_get_ui_name()); } if(!KWallet::Wallet::isEnabled()) { @@ -604,9 +607,9 @@ kwallet_unload(G_GNUC_UNUSED GPluginPlugin *plugin, return ret; } - if(qCoreApp != NULL) { - delete qCoreApp; - qCoreApp = NULL; + if(guiApp != NULL) { + delete guiApp; + guiApp = NULL; } g_clear_object(&instance); |