user1910317
user1910317

Reputation: 21

gdi functions are crashed

Im getting strange access violation from gdi functions. My application is like a graphic engine, multiple threads will request drawing of different graphic objects. A single thread will draw all graphic objects to a memory DC. The synchronization between these threads are correct.

When I prepared userdump, access violation is occurred from two threads. Following is the callstack of two threads, GetTextExtentPoint32 and CreateFontIndirect are crashed.

// Access violation from Draw Request thread.
ntdll!KiUserExceptionDispatcher+0xe
ntdll!RtlRaiseStatus+0x26
ntdll!RtlpUnWaitCriticalSection+0x3b
ntdll!RtlLeaveCriticalSection+0x1d
gdi32!GdiRealizationInfo+0x88
lpk!FontHasWesternScript+0x1e
lpk!LpkUseGDIWidthCache+0x89
gdi32!GetTextExtentPointWInternal+0x100
gdi32!GetTextExtentPoint32W+0x18

// Access violation from Drawing thread.
ntdll!KiUserExceptionDispatcher+0xe
ntdll!RtlRaiseStatus+0x26
ntdll!RtlpWaitForCriticalSection+0x204
ntdll!RtlEnterCriticalSection+0x46
gdi32!CreateFontIndirectExW+0x26
gdi32!CreateFontIndirectW+0x61 

What are the possible reasons of crashing GetTextExtentPoint32 and CreateFontIndirect. I never got two access violations in an application. How it happens ?. This application is almost stable and I never got an access violation from these points. I tried to call CreateFontIndirect( NULL ) to get an access violation, but its not crashing.. Please help me to find a reason..

Upvotes: 0

Views: 645

Answers (2)

Adrian McCarthy
Adrian McCarthy

Reputation: 47962

You have two different threads processing GDI calls at the same. If these calls involve the same device contexts or GDI objects, then you have a bug in your thread synchronization.

Upvotes: 1

Related Questions