[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [PATCH] KGpg: prevent crash on encryption
From:       bj () altern ! org
Date:       2003-12-09 13:01:11
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Fix KGpg crash on encryption if selected key is not valid.

* Make sure to KPassivePopup *pop is initialised before deleting it.
* Add some setTimeOut(0) to make sure the popup does not disappear until 
en/decryption is over.
* Remove unused bool popIsDisplayed.

Patch attached...

["kgpg.diff" (text/x-diff)]

Index: kgpglibrary.cpp
===================================================================
RCS file: /home/kde/kdeutils/kgpg/kgpglibrary.cpp,v
retrieving revision 1.20
diff -u -3 -r1.20 kgpglibrary.cpp
--- kgpglibrary.cpp	18 Nov 2003 09:44:58 -0000	1.20
+++ kgpglibrary.cpp	9 Dec 2003 12:52:52 -0000
@@ -91,6 +91,7 @@
         }
 
         KgpgInterface *cryptFileProcess=new KgpgInterface();
+	pop = new KPassivePopup();
         cryptFileProcess->KgpgEncryptFile(selec,urlselected,dest,encryptOptions,symetric);
                
         connect(cryptFileProcess,SIGNAL(processstarted()),this,SLOT(processpopup2()));
  if (shred)
@@ -102,7 +103,8 @@
 
 void KgpgLibrary::processpopup2()
 {
-        pop = new KPassivePopup();
+        
+	pop->setTimeout(0);
         pop->setView(i18n("Processing encryption"),i18n("Please \
wait..."),KGlobal::iconLoader()->loadIcon("kgpg",KIcon::Desktop));  pop->show();
         QRect qRect(QApplication::desktop()->screenGeometry());
@@ -172,8 +174,8 @@
 {
         //////////////////////////////////////////////////////////////////    decode \
file from konqueror or menu  KgpgInterface *decryptFileProcess=new KgpgInterface();
-        urlselected=srcUrl;
-        popIsDisplayed=false;
+        pop = new KPassivePopup();
+	urlselected=srcUrl;
         decryptFileProcess->KgpgDecryptFile(srcUrl,destUrl,customDecryptOption);
         connect(decryptFileProcess,SIGNAL(processaborted(bool)),this,SIGNAL(decryptionOver()));
                
         connect(decryptFileProcess,SIGNAL(processstarted()),this,SLOT(processpopup()));
 @@ -183,8 +185,7 @@
 
 void KgpgLibrary::processpopup()
 {
-        popIsDisplayed=true;
-        pop = new KPassivePopup();
+	pop->setTimeout(0);
         pop->setView(i18n("Processing decryption"),i18n("Please \
wait..."),KGlobal::iconLoader()->loadIcon("kgpg",KIcon::Desktop));  pop->show();
         QRect qRect(QApplication::desktop()->screenGeometry());
Index: kgpglibrary.h
===================================================================
RCS file: /home/kde/kdeutils/kgpg/kgpglibrary.h,v
retrieving revision 1.14
diff -u -3 -r1.14 kgpglibrary.h
--- kgpglibrary.h	25 Sep 2003 13:46:16 -0000	1.14
+++ kgpglibrary.h	9 Dec 2003 12:52:53 -0000
@@ -70,7 +70,6 @@
 private:
         QString customDecrypt,tempFile,extension;
         KURL urlselected;
-        bool popIsDisplayed;
         KPassivePopup *pop;
 	KProgress *shredProgressBar;
 
Index: listkeys.cpp
===================================================================
RCS file: /home/kde/kdeutils/kgpg/listkeys.cpp,v
retrieving revision 1.163
diff -u -3 -r1.163 listkeys.cpp
--- listkeys.cpp	7 Dec 2003 23:45:11 -0000	1.163
+++ listkeys.cpp	9 Dec 2003 12:52:56 -0000
@@ -2033,9 +2033,8 @@
                     goodpass=true;
             }
 
-            //pop = new QDialog( this,0,false,WStyle_Customize | \
WStyle_NormalBorder);  pop = new KPassivePopup();
-
+	    pop->setTimeout(0);
 
             QWidget *wid=new QWidget(pop);
             QVBoxLayout *vbox=new QVBoxLayout(wid,3);
@@ -2457,7 +2456,7 @@
         tst=QStringList::split(":",line,true);
 	if ((tst[0]=="pub") && (tst[9].isEmpty())) /// Primary User Id is separated from \
public key  uidNumber=1;
-	
+
         if (tst[0]=="uid" || tst[0]=="uat")
         {
             if (dropFirstUid)


[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic