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

List:       kde-commits
Subject:    KDE/kdepim/korganizer/printing
From:       Allen Winter <winter () kde ! org>
Date:       2009-04-12 11:41:07
Message-ID: 1239536467.365292.17882.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 952629 by winterz:

crash guard for the CalPrintDialog


 M  +12 -9     calprinter.cpp  


--- trunk/KDE/kdepim/korganizer/printing/calprinter.cpp #952628:952629
@@ -105,22 +105,24 @@
   for ( it = mPrintPlugins.begin(); it != mPrintPlugins.end(); ++it ) {
     (*it)->setSelectedIncidences( selectedIncidences );
   }
-  CalPrintDialog printDialog( mPrintPlugins, mParent );
+  QPointer<CalPrintDialog> printDialog = new CalPrintDialog( mPrintPlugins, mParent );
   KConfigGroup grp( mConfig, "" ); //orientation setting isn't in a group
-  printDialog.setOrientation( CalPrinter::ePrintOrientation( grp.readEntry( "Orientation", 1 ) ) );
-  printDialog.setPreview( preview );
-  printDialog.setPrintType( type );
+  printDialog->setOrientation( CalPrinter::ePrintOrientation( grp.readEntry( "Orientation", 1 ) ) );
+  printDialog->setPreview( preview );
+  printDialog->setPrintType( type );
   setDateRange( fd, td );
 
-  if ( printDialog.exec() == QDialog::Accepted ) {
-    grp.writeEntry( "Orientation", (int)printDialog.orientation() );
+  if ( printDialog->exec() == QDialog::Accepted ) {
+    grp.writeEntry( "Orientation", (int)printDialog->orientation() );
 
     // Save all changes in the dialog
     for ( it = mPrintPlugins.begin(); it != mPrintPlugins.end(); ++it ) {
       (*it)->doSaveConfig();
     }
-    doPrint( printDialog.selectedPlugin(), printDialog.orientation(), preview );
+    doPrint( printDialog->selectedPlugin(), printDialog->orientation(), preview );
   }
+  delete printDialog;
+
   for ( it = mPrintPlugins.begin(); it != mPrintPlugins.end(); ++it ) {
     (*it)->setSelectedIncidences( Incidence::List() );
   }
@@ -157,10 +159,11 @@
     selectedStyle->doPrint( &printer );
     printPreview.exec();
   } else {
-    QPrintDialog printDialog( &printer, mParent );
-    if ( printDialog.exec() == QDialog::Accepted ) {
+    QPointer<QPrintDialog> printDialog = new QPrintDialog( &printer, mParent );
+    if ( printDialog->exec() == QDialog::Accepted ) {
       selectedStyle->doPrint( &printer );
     }
+    delete printDialog;
   }
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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