cerror_block.add_statement (free_frag);
if (current_method is CreationMethod) {
+ var cl = current_method.parent_symbol as Class;
+ var unref_call = new CCodeFunctionCall (new CCodeIdentifier (cl.get_unref_function ()));
+ unref_call.add_argument (new CCodeIdentifier ("self"));
+ cerror_block.add_statement (new CCodeExpressionStatement (unref_call));
cerror_block.add_statement (new CCodeReturnStatement (new CCodeConstant ("NULL")));
} else if (current_method != null && current_method.coroutine) {
cerror_block.add_statement (new CCodeReturnStatement (new CCodeConstant ("FALSE")));
--- /dev/null
+GLib.List<Foo> list;
+
+errordomain Error {
+ FOOBAR,
+}
+
+class Foo : Object {
+ public Foo () throws Error {
+ list.append (this);
+ throw new Error.FOOBAR ("foo");
+ }
+}
+
+void main () {
+ Foo foo = null;
+ list = new List<Foo> ();
+ try {
+ foo = new Foo ();
+ } catch (Error err) {
+ }
+ assert (foo == null);
+ /* There should be only 1 ref in the list */
+ assert (list.nth_data (0).ref_count == 1);
+}