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:
parent
21619e8a30
commit
179d93f09d
3
tests/vibe.core.net.1452/dub.sdl
Normal file
3
tests/vibe.core.net.1452/dub.sdl
Normal file
|
@ -0,0 +1,3 @@
|
|||
name "tests"
|
||||
description "Invalid memory operation on TCP connection leakage at shutdown"
|
||||
dependency "vibe-d:core" path="../../"
|
23
tests/vibe.core.net.1452/source/app.d
Normal file
23
tests/vibe.core.net.1452/source/app.d
Normal 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
|
||||
}
|
Loading…
Reference in a new issue