[vala/wip/transform: 106/106] codegen: Use copies of error_variable of catch-clauses for nested usage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/transform: 106/106] codegen: Use copies of error_variable of catch-clauses for nested usage
- Date: Mon, 4 Feb 2019 09:28:54 +0000 (UTC)
commit d67eaa5eb5f94e68707ac026bdb08f31bac5303e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Jun 6 23:22:41 2018 +0200
codegen: Use copies of error_variable of catch-clauses for nested usage
Calling visit_local_variable() multiple times on the same instance of a
LocalVariable causes issues.
codegen/valagerrormodule.vala | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index 6855377c8..c7ca7e432 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -355,8 +355,12 @@ public class Vala.GErrorModule : CCodeDelegateModule {
ccode.open_block ();
if (clause.error_variable != null) {
- visit_local_variable (clause.error_variable);
- ccode.add_assignment (get_variable_cexpression (get_local_cname
(clause.error_variable)), get_inner_error_cexpression ());
+ // use a copy for possible nested usage
+ var error_variable = new LocalVariable (clause.error_type.copy (),
clause.variable_name);
+ error_variable.active = true;
+ error_variable.checked = true;
+ visit_local_variable (error_variable);
+ ccode.add_assignment (get_variable_cexpression (get_local_cname (error_variable)),
get_inner_error_cexpression ());
} else {
// error object is not used within catch statement, clear it
var cclear = new CCodeFunctionCall (new CCodeIdentifier ("g_clear_error"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]