Add test for issue #1452.

TCP connection should not crash the program if they are closed from within a finalizer. Instead, give a warning if such a class has leaked.

(cherry picked from commit 2c0adbc56170571991781cebf1e3aac1549828ad)
This commit is contained in:
Sönke Ludwig 2016-03-11 08:23:04 +01:00
parent 21619e8a30
commit 179d93f09d
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,3 @@
name "tests"
description "Invalid memory operation on TCP connection leakage at shutdown"
dependency "vibe-d:core" path="../../"

View file

@ -0,0 +1,23 @@
import vibe.core.core;
import vibe.core.net;
import core.time : msecs;
class C {
TCPConnection m_conn;
this()
{
m_conn = connectTCP("google.com", 443);
}
~this()
{
m_conn.close();
}
}
void main()
{
auto c = new C;
// let druntime collect c during shutdown
}