diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 426027c..cf327fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,7 @@ jobs: dc: [dmd-latest, ldc-latest] arch: [x86_64] include: + - { os: ubuntu-latest, dc: dmd-2.096.1, arch: x86_64 } - { os: windows-latest, dc: dmd-2.092.0, arch: x86_64 } - { os: windows-latest, dc: dmd-2.092.0, arch: x86_mscoff } - { os: windows-latest, dc: dmd-2.091.1, arch: x86_64 } diff --git a/dub.sdl b/dub.sdl index b6210be..bedef09 100644 --- a/dub.sdl +++ b/dub.sdl @@ -28,9 +28,9 @@ configuration "select" { subConfiguration "eventcore" "select" versions "Windows7" platform="windows" } -configuration "libasync" { - subConfiguration "eventcore" "libasync" -} +//configuration "libasync" { +// subConfiguration "eventcore" "libasync" +//} buildType "unittest" { buildOptions "unittests" "debugMode" "debugInfo" diff --git a/source/vibe/core/file.d b/source/vibe/core/file.d index cb2ff1b..4680b7d 100644 --- a/source/vibe/core/file.d +++ b/source/vibe/core/file.d @@ -699,6 +699,13 @@ scope: ~this() nothrow { + if (this.isOpen) { + if (m_ctx.driver is (() @trusted => cast(shared)eventDriver)()) { + try close(); + catch (Exception e) logException(e, "Closing unclosed FileStream during destruction failed"); + } else logWarn("Destroying FileStream that is still open in a foreign thread (leaked to GC?). This may lead to crashes."); + } + if (m_fd != FileFD.invalid) releaseHandle!"files"(m_fd, m_ctx.driver); } diff --git a/source/vibe/core/log.d b/source/vibe/core/log.d index e5e85cc..8c67421 100644 --- a/source/vibe/core/log.d +++ b/source/vibe/core/log.d @@ -833,7 +833,6 @@ final class SyslogLogger(StreamCallback) : Logger @safe nothrow { ubyte[4096] buf; - try { auto ostr = m_streamCallback(); @@ -846,6 +845,8 @@ final class SyslogLogger(StreamCallback) : Logger while (m_buffer.empty) { if (m_buffer.capacity == 0) { ostr.finalize(); + static if (is(typeof(ostr.close()))) + ostr.close(); return; } () @trusted { m_bufferCondition.wait(); } (); diff --git a/source/vibe/core/task.d b/source/vibe/core/task.d index 6c9f214..fd68144 100644 --- a/source/vibe/core/task.d +++ b/source/vibe/core/task.d @@ -39,7 +39,7 @@ struct Task { m_taskCounter = task_counter; } - this(in Task other) + this(const Task other) @safe nothrow { m_fiber = () @trusted { return cast(shared(TaskFiber))other.m_fiber; } (); m_taskCounter = other.m_taskCounter; diff --git a/source/vibe/internal/async.d b/source/vibe/internal/async.d index 2dd70d9..a8f1bf8 100644 --- a/source/vibe/internal/async.d +++ b/source/vibe/internal/async.d @@ -258,7 +258,7 @@ private template hasAnyScopeParameter(Callback) { else enum hasAnyScopeParameter = any!(c => c & ParameterStorageClass.scope_)([SC]); } -static if (is(noreturn)) // issue 299, requires newer host compilers +static if (is(noreturn)) static if (is(ReturnType!(() => assert(0)) == noreturn)) // issue 299, requires newer host compilers version (unittest) { alias CB = noreturn delegate(int) @safe nothrow; alias wait = delegate noreturn(_) => assert(0);