The crash occurs if you want to remove a file format that is used by a 
converter. Xforms doesn't allow that (and posts an error).

This patch does the same for qt2. It's not super ui, but I think
silently removing the file format and the converters is no option either.

The same has to go into qt4/
(I'll do that).

OK for branch and head?

Jürgen
Index: src/frontends/qt2/QPrefsDialog.C
===================================================================
--- src/frontends/qt2/QPrefsDialog.C	(Revision 13509)
+++ src/frontends/qt2/QPrefsDialog.C	(Arbeitskopie)
@@ -19,6 +19,8 @@
 #include "qcoloritem.h"
 #include "qfontexample.h"
 
+#include "frontends/Alert.h"
+
 #include "ui/QPrefAsciiModule.h"
 #include "ui/QPrefDateModule.h"
 #include "ui/QPrefKeyboardModule.h"
@@ -845,7 +847,14 @@ void QPrefsDialog::remove_format()
 	int const nr(fileformatsModule->formatsLB->currentItem());
 	if (nr < 0)
 		return;
-	form_->formats().erase(form_->formats().get(nr).name());
+	string const current_text = form_->formats().get(nr).name();
+	if (form_->converters().formatIsUsed(current_text)) {
+		Alert::error(_("Format in use"),
+				_("Cannot remove a Format used by a Converter. "
+				      "Remove the converter first."));
+		return;
+	}
+	form_->formats().erase(current_text);
 	updateFormats();
 	form_->converters().update(form_->formats());
 

Reply via email to