Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
brcolow committed Aug 3, 2018
1 parent ccc6d85 commit 29c01b9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions modules/javafx.graphics/src/main/native-font/directwrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <dwrite.h>
#include <d2d1.h>
#include <wincodec.h>
#include <assert.h>
#include <vector>
#include <new>

Expand Down Expand Up @@ -854,21 +855,31 @@ JNIEXPORT jlong JNICALL OS_NATIVE(_1WICCreateImagingFactory)
* Note: This method is called by DWFactory a single time.
*/
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
assert(SUCCEEDED(hr));

/* This means COM has been initialize with a different concurrency model.
* This should never happen. */
if (hr == RPC_E_CHANGED_MODE) return NULL;

IWICImagingFactory* result = NULL;
hr = CoCreateInstance(
CLSID_WICImagingFactory,
CLSID_WICImagingFactory1,
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&result)
);
if (hr == REGDB_E_CLASSNOTREG) {
hr = CoCreateInstance(
CLSID_WICImagingFactory,
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&result)
);
}
assert(SUCCEEDED(hr));

/* Unload COM as no other COM objects will be create directly */
CoUninitialize();
// CoUninitialize();
return SUCCEEDED(hr) ? (jlong)result : NULL;
}

Expand Down

0 comments on commit 29c01b9

Please sign in to comment.