soc.2008.masterpassword: 7ac05f9c: Make KWalletPlugin::request class abstra...

qulogic at pidgin.im qulogic at pidgin.im
Sun Nov 20 04:35:57 EST 2011


----------------------------------------------------------------------
Revision: 7ac05f9c1ef23595a177ced9d9161c53d6c341e6
Parent:   09618b7c9a9e5e2d44608a2e70a50ab3e1b2492b
Author:   qulogic at pidgin.im
Date:     11/19/11 19:27:39
Branch:   im.pidgin.soc.2008.masterpassword
URL: http://d.pidgin.im/viewmtn/revision/info/7ac05f9c1ef23595a177ced9d9161c53d6c341e6

Changelog: 

Make KWalletPlugin::request class abstract. Unfortunately, this
seems to mean I need to manage its allocation/destruction, but
that's not too bad here.

Changes against parent 09618b7c9a9e5e2d44608a2e70a50ab3e1b2492b

  patched  libpurple/plugins/keyrings/kwallet.cpp

-------------- next part --------------
============================================================
--- libpurple/plugins/keyrings/kwallet.cpp	df5286062e817d8de257f5f2ad32408b470b741a
+++ libpurple/plugins/keyrings/kwallet.cpp	681c4359e2ce83a824b3681d9db41c648792b560
@@ -52,8 +52,8 @@ class request
 class request
 {
 	public:
-		virtual void abort();
-		virtual void execute(KWallet::Wallet *wallet);
+		virtual void abort() = 0;
+		virtual void execute(KWallet::Wallet *wallet) = 0;
 
 	protected:
 		gpointer data;
@@ -66,7 +66,7 @@ class engine : QObject
 	public:
 		engine();
 		~engine();
-		void queue(request req);
+		void queue(request *req);
 		static engine *Instance();
 
 	signals:
@@ -75,7 +75,7 @@ class engine : QObject
 	private:
 		bool connected;
 		KWallet::Wallet *wallet;
-		std::list<request> requests;
+		std::list<request*> requests;
 		static engine *pinstance;
 
 /*		KApplication *app; */
@@ -126,9 +126,10 @@ KWalletPlugin::engine::~engine()
 KWalletPlugin::engine::~engine()
 {
 	while (!requests.empty()) {
-		request &req = requests.front();
-		req.abort();
+		request *req = requests.front();
+		req->abort();
 		requests.pop_front();
+		delete req;
 	}
 
 	KWallet::Wallet::closeWallet(KWallet::Wallet::NetworkWallet(), TRUE);
@@ -153,16 +154,17 @@ KWalletPlugin::engine::walletOpened(bool
 		ExecuteRequests();
 	} else {
 		while (!requests.empty()) {
-			request &req = requests.front();
-			req.abort();
+			request *req = requests.front();
+			req->abort();
 			requests.pop_front();
+			delete req;
 		}
 		delete this;
 	}
 }
 
 void
-KWalletPlugin::engine::queue(request req)
+KWalletPlugin::engine::queue(request *req)
 {
 	requests.push_back(req);
 	ExecuteRequests();
@@ -173,9 +175,10 @@ KWalletPlugin::engine::ExecuteRequests()
 {
 	if (connected) {
 		while (!requests.empty()) {
-			request &req = requests.front();
-			req.execute(wallet);
+			request *req = requests.front();
+			req->execute(wallet);
 			requests.pop_front();
+			delete req;
 		}
 	}
 }
@@ -260,7 +263,8 @@ kwallet_read(PurpleAccount *account,
              PurpleKeyringReadCallback cb,
              gpointer data)
 {
-	KWalletPlugin::read_request req(account, cb, data);
+	KWalletPlugin::read_request *req;
+	req = new KWalletPlugin::read_request(account, cb, data);
 	KWalletPlugin::engine::Instance()->queue(req);
 }
 
@@ -270,7 +274,8 @@ kwallet_save(PurpleAccount *account,
              PurpleKeyringSaveCallback cb,
              gpointer data)
 {
-	KWalletPlugin::save_request req(account, password, cb, data);
+	KWalletPlugin::save_request *req;
+	req = new KWalletPlugin::save_request(account, password, cb, data);
 	KWalletPlugin::engine::Instance()->queue(req);
 }
 


More information about the Commits mailing list