ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Crashing Problems with WIC?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
spurgeon Posted - Dec 05 2018 : 09:43:01
We upgraded from 7.5.0 to 8.1.0 in our latest software update on the Microsoft Store. Since then, we have users stating that the software crashes when opening up image file types, such as JPEG and HEIC. I found the following stack traces in our developer dashboard, and they appear to be related to WIC (Windows Imaging Component) loading.

1 KERNELBASE.dll WaitForSingleObjectEx 0x0000000000000099
2 SHCore.dll WorkThreadManager::CThread::WaitForThreadStart 0x0000000000000016
3 SHCore.dll WorkThreadManager::s_QueuePoolTask 0x0000000000000186
4 SHCore.dll SHTaskPoolQueueTask 0x00000000000000BE
5 Windows.ApplicationModel.dll Windows::Internal::ComTaskPoolHandler::Start 0x000000000000002A
6 Windows.ApplicationModel.dll Windows::Internal::AsyncOperation_Windows::Foundation::IAsyncOperation_bool_,Windows::Foundation::IAsyncOperationCompletedHandler_bool_,Windows::Internal::CBasicResult_unsigned char,0_,Windows::Internal::ComTaskPoolHandler,Windows::In 0x0000000000000046
7 Windows.ApplicationModel.dll Microsoft::WRL::AsyncBase_Windows::Foundation::IAsyncOperationCompletedHandler_bool_,Microsoft::WRL::Details::Nil,1,Microsoft::WRL::AsyncOptions_-1,0,&GUID_CAUSALITY_WINDOWS_PLATFORM_ID,2_ _::Start 0x000000000000002A
8 Windows.ApplicationModel.dll Windows::Internal::MakeAsyncHelper_Windows::Foundation::IAsyncOperation_bool_,Windows::Foundation::IAsyncOperationCompletedHandler_bool_,Windows::Internal::INilDelegate,Windows::Internal::CBasicResult_unsigned char,0_,Windows::Interna 0x000000000000006C
9 Windows.ApplicationModel.dll Windows::ApplicationModel::PackageServer::VerifyContentIntegrityAsync 0x00000000000000C6
10 Windows.Media.dll Windows::Media::MediaExtensionAppServices::MediaExtensionBrokerStatics::ValidateIntegrityAndLicenseForPackage 0x000000000000049B
11 mfplat.dll ValidateCodecPackage 0x0000000000000286
12 mfplat.dll CMFWinrtInprocActivate::ActivateObject 0x0000000000000107
13 MSHEIF.dll CreateWICComponent 0x00000000000001E2
14 MSHEIF.dll CWICHeifDecoderClassFactory::CreateInstance 0x00000000000000AF
15 combase.dll CServerContextActivator::CreateInstance 0x00000000000001FB
16 combase.dll ActivationPropertiesIn::DelegateCreateInstance 0x00000000000000ED
17 combase.dll CApartmentActivator::CreateInstance 0x00000000000000AE
18 combase.dll CProcessActivator::CCICallback 0x000000000000005A
19 combase.dll CProcessActivator::AttemptActivation 0x0000000000000035
20 combase.dll CProcessActivator::ActivateByContext 0x00000000000000C7
21 combase.dll CProcessActivator::CreateInstance 0x0000000000000060
22 combase.dll ActivationPropertiesIn::DelegateCreateInstance 0x00000000000000B6
23 combase.dll CClientContextActivator::CreateInstance 0x00000000000000FD
24 combase.dll ActivationPropertiesIn::DelegateCreateInstance 0x00000000000000BD
25 combase.dll ICoCreateInstanceEx 0x0000000000000B72
26 combase.dll CComActivator::DoCreateInstance 0x0000000000000175
27 combase.dll CoCreateInstance 0x00000000000000A7
28 WindowsCodecs.dll CCodecInfo::CreateInstance 0x00000000000000B0
29 WindowsCodecs.dll CCodecFactory::HrCreateCodecComponent 0x0000000000000285
30 WindowsCodecs.dll CCodecFactory::CreateDecoder
31 OUR APP's DLL using ImageEn...

0 combase.dll CrashProcessWithWERReport 0x0000000000000035
1 combase.dll DecrementMTAUsageHelper 0x00000000000000FD
2 combase.dll CoDecrementMTAUsage 0x0000000000000019
3 RTWorkQ.dll CPlatform::ShutdownGlobal 0x00000000000000A0
4 RTWorkQ.dll CPlatform::FinalShutdown 0x000000000000018A
5 RTWorkQ.dll CPlatform::Shutdown 0x0000000000000066
6 RTWorkQ.dll RtwqShutdown 0x0000000000000013
7 msheif_store.dll CWICHeifCodecCommon::~CWICHeifCodecCommon 0x0000000000000021
8 msheif_store.dll CWICHeifDecoder::~CWICHeifDecoder 0x000000000000006E
9 msheif_store.dll CWICHeifDecoder::`scalar deleting destructor' 0x000000000000000D
10 Microsoft::WRL::Details::RuntimeClassImpl_Microsoft::WRL::RuntimeClassFlags_3_,1,1,0,IWICBitmapDecoder,Microsoft::WRL::MixIn_CWICHeifDecoder,CWICHeifCodecCommon,1_,Windows::Media::IMediaExtension,Microsoft::WRL::CloakedIid_IMFTransform_,Microsoft::WRL::Cl 0x0000000000000057
11 OUR APP's DLL using ImagEn...

I'm wondering if this issue only occurs for users who have installed the Microsoft extensions for HEIC files, or some other WIC extension. Is there a way for us to cancel WIC loading for types? It looks like the behavior was changed in 8.0 where WIC loading is used by default to load image types when it is possible?
8   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jan 07 2019 : 20:34:38
Hi

Checking for HEIF support on startup triggers a crash when run under a DLL. We will have a fix for this in 8.3.0.

Nigel
Xequte Software
www.imageen.com
xequte Posted - Dec 21 2018 : 00:17:22
Hi

I cannot see any particular issue in the code, and cannot reproduce the issue in a standard environment.

Unfortunately we need to load the HEIF decoder on start-up to check whether the format is supported (as it not available by default). It might be best for us to add a define to allow HEIF loading to be excluded.


Nigel
Xequte Software
www.imageen.com
spurgeon Posted - Dec 08 2018 : 13:25:17
Nigel, thanks again for your support. No problem about after Christmas. We released a bug fix update that removes the setup of the ioHeif WIC decoder in iewic.pas, so we're ok for now.

I compiled one of the ImagEn demos and it did not crash, so there is a difference between the demo and our app's use of ImageEn. Admittedly, we are integrating ImageEn in an unconventional way, but perhaps more details offline due to proprietary stuff. I'll send an email next week. Hope you have a Merry Christmas!
xequte Posted - Dec 07 2018 : 20:27:35
Hi

I'm afraid I won't be able to investigate this until after Christmas, because I am travelling (and the WIC code is mine).

I'd like to reproduce it at my end. Does it occur in any of our demos?

Nigel
Xequte Software
www.imageen.com
spurgeon Posted - Dec 07 2018 : 10:50:41
I've traced the crash to this line in iewic.pas:

function TIEWICReader.DecoderInfo(FileFormat: TIOFileType; out FriendlyName: string; out GUID: TGuid; out Extensions: string; out Version: string; out Author: string): boolean;
begin
// ...
fWICImagingFactory.CreateDecoder(DecoderGuid, GUID_NULL, fDecoder); // <- here
// ...
end;


It crashes on this line when TIOFileType is ioHEIF and Microsoft HEIF Image Extensions is installed in Windows 10 1803+. iexBitmaps.pas flows through all previous WIC decoder initialization fine.

I suppose I could just not load WIC for ioHEIF or just turn it off via $IEINCLUDEWIC and I'd probably be ok, but I'd also be interested in some insight as to why this is happening. Any thoughts as to why the decoder blows up during initialization when Microsoft HEIF Image Extensions is installed?
spurgeon Posted - Dec 06 2018 : 12:05:07
Sorry, nevermind about the source diff. I went ahead and installed the two versions (7.5.0 and 8.1.1) and just grabbed the source and am looking at the diff now.

If you have any ideas as to what could cause an initialization issue with 8.1.1 with respect to WIC, based on what's different from 7.5.0, that would help me investigate. Based on the way we're using ImageEn, we can't debug/step through the code, but we could potentially drop some log statements.
spurgeon Posted - Dec 06 2018 : 10:53:39
I was able to reproduce the crash in our app with Windows 10 1803 with HEIF Image Extensions installed, as well as with Windows 10 1809, which now includes HEIF support by default. I reverted to ImageEn 7.5.0 and ielib32.dll from 7.5.0 and there are no more crashes. I don't think this is an edge case or WIC fallback case for us since it's consistent and reproducible.

Do you host the source somewhere where I can do 7.5.0 and 8.1.1 diff easily? I believe there is something happening in the ImageEn 8.0+ initialization that's not jiving with our context, and an educated guess is that it has to do with the new WIC stuff added to ImageEn 8.0+. I never get to the point of TImageEn.LoadFromFile(), since the DLL we've compiled ImageEn into appears to fail during initialization.
xequte Posted - Dec 05 2018 : 20:12:41
Hi

Generally WIC will not be used for any format that is natively supported (unless an option such as WIC loading is enabled), but one issue we did not consider is that ImageEn will attempt to use WIC when other formats have failed, e.g. a corrupt JPEG may not be recognized by ImageEn, so it will try using WIC (And perhaps because of the corruption WIC crashes, or maybe WIC is broken on that system)?

If it is only certain images, that cause a crash, can you supply them. I would like to reproduce here (BTW, we are using the HEIC extension without issue).

I think for 8.1.3 we will need to make ImageEn much more cautious about when it falls back to WIC.

Nigel
Xequte Software
www.imageen.com