[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] QED crash when closing the Syntax dialog



Hello.

I have found a bug on my home compiled QED. It crashes when closing the Options > Syntax dialog, just after clicking Cancel.

The bug is in src/options.c, function set_syntax_options().
When Hl_EnumTxtNames() does not return anything (no text rules), create_popup() is not called so txtnames remains uninitialized. When the dialog is closed, free_popup() is called with the uninitialized txtnames popup then it crashes (tested with EasyMiNT).

It is "funny" to see it behaves differently on ST. Due to the 24-bit address bus, free_popup() loops during 4 seconds on wrong but valid addresses, then it succeeds after 4 seconds.

The attached patch fixes the problem.
Please commit it with the following CVS comment:

Fixed crash when closing the Syntax dialog when there are no text rules.

--
Vincent Rivière
diff -aurN qed-CVS-20101221.orig/src/options.c qed-CVS-20101221/src/options.c
--- qed-CVS-20101221.orig/src/options.c	2010-12-24 17:08:35.421875000 +0100
+++ qed-CVS-20101221/src/options.c	2010-12-24 17:00:17.750000000 +0100
@@ -759,12 +759,14 @@
 			act_txttype = 0;
 	}
 
+	txtnames.tree = NULL;
 	if (!build_txtname_popup(act_txttype, &txtnames))
 	{
 		set_string(syntaxop, SYOTXT, "");
 		set_state(syntaxop, SYOTXT, OS_DISABLED, TRUE);
 		set_state(syntaxop, SYOACTIVE, OS_DISABLED, TRUE);
 	}
+	rules.tree = NULL;
 	build_rule_popup(act_txttype, &rules);
 	get_syntax_settings(act_txttype, 0);