diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-04-14 08:47:02 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-04-17 15:07:57 +0200 |
commit | a2166dfd4175ed1da0b59e0b618b092d62ed3401 (patch) | |
tree | 56ca63361f010f9058bcf2292fa6fb8697e2c1fc /cli_ure/source/climaker | |
parent | 8978d12cbc475fa4c94a9a6b65d2e3f7219eb227 (diff) |
Avoid MSVC error C2039
At least with VS 2022 Preview 17.6.0 Preview 3.0 and (if that makes a difference
here) --with-latest-c++, the build started to fail now for me with
> cli_ure/source/climaker/climaker_app.cxx(603): error C2039: '{dtor}': is not a member of 'System::IDisposable'
Originally, in 4c937bbdbbfd954936fdc92c4b35d90c2233719e "#107130# new",
TypeEmitter in cli_ure/source/climaker/climaker_share.h had been defined as
> __gc class TypeEmitter : public ::System::IDisposable
with an overriding Dispose member function (and no user-declared dtor), and the
code in cli_ure/source/climaker/climaker_app.cxx had called
> type_emitter->Dispose();
when done. Then, in 6fa1a74ec4bb5820d1638ff3b872476f8652efe0 "convert climaker
to new syntax", the definition of TypeEmitter had been changed to
> ref class TypeEmitter : public ::System::IDisposable
with a dtor instead of the overriding Dispose member function, and the code in
cli_ure/source/climaker/climaker_app.cxx had been changed to call
> type_emitter->~TypeEmitter();
instead.
I have no deep understanding of the Managed C++/CLI stuff at play here, but it
looks reasonable to avoid all this by not deriving from IDisposable (and relying
on GC to clean up all instances) and introducing some explicit finish()
protocol.
Change-Id: I8ebfba9d9f9c32b65a50104d200306e06dc69f73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150387
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'cli_ure/source/climaker')
-rw-r--r-- | cli_ure/source/climaker/climaker_app.cxx | 2 | ||||
-rw-r--r-- | cli_ure/source/climaker/climaker_emit.cxx | 2 | ||||
-rw-r--r-- | cli_ure/source/climaker/climaker_share.h | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/cli_ure/source/climaker/climaker_app.cxx b/cli_ure/source/climaker/climaker_app.cxx index 9c596cd97017..b2ba44fef0e8 100644 --- a/cli_ure/source/climaker/climaker_app.cxx +++ b/cli_ure/source/climaker/climaker_app.cxx @@ -600,7 +600,7 @@ SAL_IMPLEMENT_MAIN() UNO_QUERY_THROW ) ); } } - type_emitter->~TypeEmitter(); + type_emitter->finish(); if (g_bVerbose) { diff --git a/cli_ure/source/climaker/climaker_emit.cxx b/cli_ure/source/climaker/climaker_emit.cxx index e34a9b088bda..4f4dceef9fa2 100644 --- a/cli_ure/source/climaker/climaker_emit.cxx +++ b/cli_ure/source/climaker/climaker_emit.cxx @@ -2154,7 +2154,7 @@ Emit::CustomAttributeBuilder^ TypeEmitter::get_exception_attribute( //get_type will asked the module builder for the type or otherwise all known assemblies. return get_type(sName, true); } -TypeEmitter::~TypeEmitter() +void TypeEmitter::finish() { while (true) { diff --git a/cli_ure/source/climaker/climaker_share.h b/cli_ure/source/climaker/climaker_share.h index ed7ab256a3ad..29c3c876426e 100644 --- a/cli_ure/source/climaker/climaker_share.h +++ b/cli_ure/source/climaker/climaker_share.h @@ -110,7 +110,7 @@ static ::System::Reflection::MethodAttributes c_ctor_method_attr = ::System::Reflection::MethodAttributes::Instance*/); -ref class TypeEmitter : public ::System::IDisposable +ref class TypeEmitter { ::System::Reflection::Emit::ModuleBuilder ^ m_module_builder; array< ::System::Reflection::Assembly^>^ m_extra_assemblies; @@ -243,7 +243,7 @@ public: ::System::Reflection::Emit::ModuleBuilder ^ module_builder, array< ::System::Reflection::Assembly^>^ assemblies ); // must be called to finish up uncompleted types - ~TypeEmitter(); + void finish(); ::System::Reflection::Assembly ^ type_resolve( ::System::Object ^ sender, ::System::ResolveEventArgs ^ args ); |