Skip to content

Commit 53d7e66

Browse files
committed
Fix some build errors on Linux.
1 parent e5488a7 commit 53d7e66

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

lib/Runtime/Base/WindowsGlobalizationAdapter.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ namespace Js
145145
return unicodeStatics;
146146
}
147147
#endif
148-
#ifdef ENABLE_INTL_OBJECT
148+
#ifdef ENABLE_INTL_OBJECT
149149
private:
150150
HRESULT CreateTimeZoneOnCalendar(_In_ DelayLoadWindowsGlobalization *library, __out Windows::Globalization::ITimeZoneOnCalendar** result);
151151
static HRESULT VerifyResult(HSTRING * result, HRESULT errCode);
@@ -200,8 +200,11 @@ namespace Js
200200
// Here we use Cleanup() because we can't rely on delete (not dealing with virtual destructors).
201201
// The template thus requires that the type implement the Cleanup function.
202202
instance->Cleanup(); // e.g. deletes the object held in the IPlatformAgnosticResource
203-
delete instance; // deletes the instance itself
204-
instance = nullptr;
203+
204+
// REVIEW (doilij): Is cleanup in this way necessary or are the trivial destructors enough, assuming Cleanup() has been called?
205+
// Note: delete here introduces a build break on Linux complaining of non-virtual dtor
206+
// delete instance; // deletes the instance itself
207+
// instance = nullptr;
205208
}
206209
}
207210

lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,9 @@ namespace Js
871871
}
872872

873873
Assert(numberFormatter);
874-
PlatformAgnostic::Resource::AutoPtr<PlatformAgnostic::Resource::IPlatformAgnosticResource> numberFormatterGuard(numberFormatter);
874+
// REVIEW (doilij): AutoPtr will call delete on IPlatformAgnosticResource and complain of non-virtual dtor. There are no IfFailThrowHr so is this still necessary?
875+
// TODO (doilij): If necessary, introduce an PlatformAgnosticResourceAutoPtr that calls Cleanup() instead of delete on the pointer.
876+
// PlatformAgnostic::Resource::AutoPtr<PlatformAgnostic::Resource::IPlatformAgnosticResource> numberFormatterGuard(numberFormatter);
875877

876878
// TODO (doilij): Render signed zero.
877879

@@ -937,7 +939,7 @@ namespace Js
937939
options->SetInternalProperty(Js::InternalPropertyIds::HiddenObject, autoObject, Js::PropertyOperationFlags::PropertyOperation_None, NULL);
938940

939941
// clear the pointer so it is not freed when numberFormatterGuard goes out of scope
940-
numberFormatterGuard.setPointer(nullptr);
942+
// numberFormatterGuard.setPointer(nullptr);
941943

942944
return scriptContext->GetLibrary()->GetUndefined();
943945
#else

lib/Runtime/PlatformAgnostic/IPlatformAgnosticResource.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ namespace Resource
2626
AutoPtr(const T *ptr) : pointer(ptr) {}
2727
~AutoPtr()
2828
{
29-
delete pointer;
29+
if (pointer != nullptr)
30+
{
31+
delete pointer;
32+
pointer = nullptr;
33+
}
3034
}
3135

3236
void setPointer(const T *ptr)

lib/Runtime/PlatformAgnostic/Platform/Common/Intl.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
typedef int16_t int16;
1212
typedef int32_t int32;
1313
typedef int64_t int64;
14+
15+
/*
16+
using uint16 = unsigned int16_t;
17+
using uint32 = unsigned int32;
18+
using uint64 = unsigned int64;
19+
*/
1420
#include "Codex/Utf8Codex.h"
1521

1622
#ifndef _WIN32

0 commit comments

Comments
 (0)