http://bugs.winehq.org/show_bug.cgi?id=32654
--- Comment #4 from Anastasius Focht focht@gmx.net 2013-03-02 18:08:43 CST --- Hello Vincent,
filtered relay/windowscodecs trace log before the problem:
--- snip --- 002b:trace:wincodecs:TiffEncoder_CreateInstance ((nil),{00000103-a8f2-4877-ba0a-fd2b6645fb94},0x32f03c) 002b:trace:wincodecs:TiffEncoder_QueryInterface (0x65f2020,{00000103-a8f2-4877-ba0a-fd2b6645fb94},0x32f03c) 002b:trace:wincodecs:TiffEncoder_AddRef (0x65f2020) refcount=2 002b:trace:wincodecs:TiffEncoder_Release (0x65f2020) refcount=1 002b:trace:wincodecs:ClassFactoryImpl_Release (0x65f2008) refcount=0 002b:trace:wincodecs:BitmapEncoderInfo_Release (0x65e4f88) refcount=2 002b:trace:wincodecs:BitmapEncoderInfo_Release (0x65e4f88) refcount=1 002b:trace:wincodecs:ComponentEnum_Release (0x65e4f38) refcount=0 002b:trace:wincodecs:BitmapEncoderInfo_Release (0x65e4f88) refcount=0 002b:trace:wincodecs:BitmapEncoderInfo_Release (0x65e4fc8) refcount=0 002b:trace:wincodecs:BitmapEncoderInfo_Release (0x65e5008) refcount=0 002b:trace:wincodecs:BitmapEncoderInfo_Release (0x65e8440) refcount=0 002b:trace:wincodecs:BitmapEncoderInfo_Release (0x65e8480) refcount=0 002b:Ret windowscodecs.IWICImagingFactory_CreateEncoder_Proxy() retval=00000000 ret=0f29c0ec 002b:trace:wincodecs:ComponentFactory_Release (0x65e4f20) refcount=0 002b:Call windowscodecs.IWICBitmapEncoder_Initialize_Proxy(065f2020,0661e678,00000002) ret=0f29dc8c 002b:trace:wincodecs:TiffEncoder_Initialize (0x65f2020,0x661e678,2) 002b:Ret windowscodecs.IWICBitmapEncoder_Initialize_Proxy() retval=00000000 ret=0f29dc8c 002b:Call windowscodecs.IWICBitmapEncoder_CreateNewFrame_Proxy(065f2020,0032f234,0032f230) ret=0f29e7e1 002b:trace:wincodecs:TiffEncoder_CreateNewFrame (0x65f2020,0x32f234,0x32f230) 002b:trace:wincodecs:TiffEncoder_AddRef (0x65f2020) refcount=2 002b:Ret windowscodecs.IWICBitmapEncoder_CreateNewFrame_Proxy() retval=00000000 ret=0f29e7e1 002b:Call windowscodecs.IWICBitmapFrameEncode_Initialize_Proxy(0661e6c0,001931c8) ret=0f29f0ad 002b:trace:wincodecs:TiffFrameEncode_Initialize (0x661e6c0,0x1931c8) 002b:Ret windowscodecs.IWICBitmapFrameEncode_Initialize_Proxy() retval=00000000 ret=0f29f0ad 002b:Call windowscodecs.IWICBitmapFrameEncode_SetSize_Proxy(0661e6c0,00000010,00000010) ret=0f29f31c 002b:trace:wincodecs:TiffFrameEncode_SetSize (0x661e6c0,16,16) 002b:Ret windowscodecs.IWICBitmapFrameEncode_SetSize_Proxy() retval=00000000 ret=0f29f31c 002b:Call windowscodecs.IWICBitmapFrameEncode_SetResolution_Proxy(0661e6c0,00000000,40580000,00000000,40580000) ret=0f268e08 002b:trace:wincodecs:TiffFrameEncode_SetResolution (0x661e6c0,96.00,96.00) 002b:Ret windowscodecs.IWICBitmapFrameEncode_SetResolution_Proxy() retval=00000000 ret=0f268e08 002b:Call windowscodecs.WICSetEncoderFormat_Proxy(001b7e60,00000000,0661e6c0,0032f15c) ret=0f29f5bb 002b:trace:wincodecs:WICSetEncoderFormat_Proxy 0x1b7e60,(nil),0x661e6c0,0x32f15c 002b:trace:wincodecs:BitmapImpl_GetPixelFormat (0x1b7e60,0x32f008) 002b:trace:wincodecs:TiffFrameEncode_SetPixelFormat (0x661e6c0,{6fddc324-4e03-4bfe-b185-3d77768dc90f}) 002b:trace:wincodecs:BitmapImpl_AddRef (0x1b7e60) refcount=5 002b:Ret windowscodecs.WICSetEncoderFormat_Proxy() retval=00000000 ret=0f29f5bb 002b:Call windowscodecs.IWICBitmapFrameEncode_WriteSource_Proxy(0661e6c0,001b7e60,0032f214) ret=0f29f77b 002b:trace:wincodecs:TiffFrameEncode_WriteSource (0x661e6c0,0x1b7e60,0x32f214) 002b:trace:wincodecs:BitmapImpl_GetPixelFormat (0x1b7e60,0x32ef7c) 002b:Ret windowscodecs.IWICBitmapFrameEncode_WriteSource_Proxy() retval=80070057 ret=0f29f77b --- snip ---
This is the managed callstack at the point of failure:
--- snip --- (2a.2b): CLR exception - code e0434352 (first chance) Child SP IP Call Site 0033f158 7b83aabb [HelperMethodFrame: 0033f158] 0033f1a8 0f2cee3c System.Windows.Media.Imaging.BitmapEncoder.SaveFrame(System.Windows.Media.SafeMILHandle, System.Windows.Media.SafeMILHandle, System.Windows.Media.Imaging.BitmapFrame) 0033f26c 0f2cbdeb System.Windows.Media.Imaging.BitmapEncoder.Save(System.IO.Stream) 0033f2ec 0f2ca35c Microsoft.VisualStudio.PlatformUI.MainWindow.SetWindowIcon() 0033f320 0f2c56c1 Microsoft.VisualStudio.PlatformUI.MainWindow.OnSourceInitialized(System.EventArgs) 0033f350 0f0a9e0f System.Windows.Window.CreateSourceWindow(Boolean) 0033f420 0f0a99c7 System.Windows.Interop.WindowInteropHelper.EnsureHandle() 0033f430 04c4d06f Microsoft.Internal.VisualStudio.PlatformUI.WpfHostPrivate.CreateWPFUIElementContainer(System.String, IntPtr, Microsoft.VisualStudio.Shell.Interop.IVsUIElement, Microsoft.VisualStudio.Shell.Interop.IVsUIDataSource, System.Object, Microsoft.Internal.VisualStudio.Shell.Interop.IVsUIWPFElementContainerPrivate ByRef) 0033f46c 04c4632c DomainNeutralILStubClass.IL_STUB_COMtoCLR(IntPtr, Int32, IntPtr, IntPtr, IntPtr, IntPtr) ... --- snip ---
What I deduce through .NET debugger is that the rectangle created by the caller of IWICBitmapFrameEncode::WriteSource() is indeed an empty one (BitmapEncoder.SaveFrame). Corresponding .NET code might look like this:
--- snip --- ... Int32Rect rect = new Int32Rect(); WICBitmapFrameEncode.WriteSource( ..., ref rect) --- snip ---
MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ee690159%28v=vs.85%2...
--- quote --- HRESULT WriteSource( [in] IWICBitmapSource *pIBitmapSource, [in, unique] WICRect *prc );
... Parameters
pIBitmapSource [in]
Type: IWICBitmapSource*
The bitmap source to encode. prc [in]
Type: WICRect*
The size rectangle of the bitmap source.
...
If SetSize is not called prior to calling WriteSource, the size given in prc is used if not NULL. Otherwise, the size of the IWICBitmapSource given in pIBitmapSource is used. --- quote ---
SetSize() is definitely called prior to WriteSource().
Regards