[rkward-cvs] rkward/rkward/dialogs rkloadlibsdialog.cpp,1.17,1.18 rkloadlibsdialog.h,1.6,1.7

Thomas Friedrichsmeier tfry at users.sourceforge.net
Wed Oct 26 16:10:34 UTC 2005


Update of /cvsroot/rkward/rkward/rkward/dialogs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24964/rkward/dialogs

Modified Files:
	rkloadlibsdialog.cpp rkloadlibsdialog.h 
Log Message:
Fixed random crash while deleting RKLoadLibsDialog. Workaround for rare crash in RControlWindow

Index: rkloadlibsdialog.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dialogs/rkloadlibsdialog.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** rkloadlibsdialog.cpp	20 Oct 2005 19:45:54 -0000	1.17
--- rkloadlibsdialog.cpp	26 Oct 2005 16:10:31 -0000	1.18
***************
*** 69,72 ****
--- 69,80 ----
  	delete error_dialog;
  	delete installation_error_dialog;
+ 
+ 	if (accepted) accept ();
+ 	else reject ();
+ }
+ 
+ void RKLoadLibsDialog::deleteThisNow () {
+ 	RK_TRACE (DIALOGS);
+ 	deleteLater ();
  }
  
***************
*** 78,88 ****
  	dialog->showPage (2);
  	dialog->exec ();
  }
  
  void RKLoadLibsDialog::tryDestruct () {
  	RK_TRACE (DIALOGS);
! 	if (accepted) accept ();
! 	else reject ();
! 	
  	if (num_child_widgets <= 0) {
  		deleteThis ();
--- 86,95 ----
  	dialog->showPage (2);
  	dialog->exec ();
+ 	RK_TRACE (DIALOGS);
  }
  
  void RKLoadLibsDialog::tryDestruct () {
  	RK_TRACE (DIALOGS);
! 
  	if (num_child_widgets <= 0) {
  		deleteThis ();
***************
*** 93,97 ****
  	RK_TRACE (DIALOGS);
  	--num_child_widgets;
! 	if (should_destruct) tryDestruct ();
  }
  
--- 100,104 ----
  	RK_TRACE (DIALOGS);
  	--num_child_widgets;
! 	tryDestruct ();
  }
  
***************
*** 99,106 ****
  	RK_TRACE (DIALOGS);
  
- 	emit (okClicked ());
  	accepted = true;
  	hide ();
! 	tryDestruct ();
  }
  
--- 106,112 ----
  	RK_TRACE (DIALOGS);
  
  	accepted = true;
  	hide ();
! 	emit (okClicked ());
  }
  
***************
*** 114,121 ****
  	RK_TRACE (DIALOGS);
  	
- 	emit (cancelClicked ());
  	accepted = false;
  	hide ();
! 	tryDestruct ();
  }
  
--- 120,126 ----
  	RK_TRACE (DIALOGS);
  	
  	accepted = false;
  	hide ();
! 	emit (cancelClicked ()); // will self-destruct via childDeleted ()
  }
  
***************
*** 128,132 ****
  void RKLoadLibsDialog::closeEvent (QCloseEvent *e) {
  	RK_TRACE (DIALOGS);
! 	QDialog::closeEvent (e);
  	slotCancel ();
  }
--- 133,137 ----
  void RKLoadLibsDialog::closeEvent (QCloseEvent *e) {
  	RK_TRACE (DIALOGS);
! 	e->accept ();
  	slotCancel ();
  }
***************
*** 153,157 ****
  	RKGlobals::rInterface ()->issueCommand (command, chain);
  	
! 	if (RKCancelDialog::showCancelDialog (i18n ("Fetch list"), i18n ("Please, stand by while downloading the list of packages."), this, this, SIGNAL (downloadComplete ()), command) == QDialog::Rejected) return false;
  	return true;
  }
--- 158,162 ----
  	RKGlobals::rInterface ()->issueCommand (command, chain);
  	
! 	if (RKCancelDialog::showCancelDialog (i18n ("Fetch list"), i18n ("Please, stand by while downloading selected packages."), this, this, SIGNAL (downloadComplete ()), command) == QDialog::Rejected) return false;
  	return true;
  }
***************
*** 582,586 ****
  InstallPackagesWidget::~InstallPackagesWidget () {
  	RK_TRACE (DIALOGS);
- 	delete placeholder;
  }
  
--- 587,590 ----
***************
*** 634,638 ****
  	
  	get_list_button->setEnabled (false);
! 	RKCancelDialog::showCancelDialog (i18n ("Fetch list"), i18n ("Please, stand by while downloading packages from CRAN."), this, this, SIGNAL (actionDone ()), command);
  }
  
--- 638,642 ----
  	
  	get_list_button->setEnabled (false);
! 	RKCancelDialog::showCancelDialog (i18n ("Fetch list"), i18n ("Please, standy by while downloading list of packages."), this, this, SIGNAL (actionDone ()), command);
  }
  

Index: rkloadlibsdialog.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dialogs/rkloadlibsdialog.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** rkloadlibsdialog.h	18 Oct 2005 15:54:04 -0000	1.6
--- rkloadlibsdialog.h	26 Oct 2005 16:10:31 -0000	1.7
***************
*** 60,63 ****
--- 60,66 ----
  	void rCommandDone (RCommand *command);
  	void closeEvent (QCloseEvent *e);
+ /** reimplemented from RCommandReceiver to call QObject::deleteLater () instead of delete this. Not entirely sure, what's going on, but otherwise we
+ get a double deletion -> crash */
+ 	void deleteThisNow ();
  protected slots:
  	void slotOk ();
***************
*** 71,75 ****
  private:
  	void tryDestruct ();
- 	bool should_destruct;
  friend class LoadUnloadWidget;
  friend class UpdatePackagesWidget;
--- 74,77 ----





More information about the rkward-tracker mailing list