Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vala: Restore DestroysInstance behaviour for non-compact classes
Although this attribute is not meant to be applied on methods of reference counted classes, the original behaviour should not be changed silently. Regression of 3d83f31 Fixes https://gitlab.gnome.org/GNOME/vala/issues/873
- Loading branch information
Showing
3 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class Foo : Object { | ||
[DestroysInstance] | ||
public void free () { | ||
assert (this.ref_count == 2); | ||
this.unref (); | ||
} | ||
} | ||
|
||
void main () { | ||
var foo = new Foo (); | ||
{ | ||
foo.free (); | ||
} | ||
assert (foo.ref_count == 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters