Make VIRTUAL_SetFaultHandler an internal function (take 3)

Alexandre Julliard julliard at winehq.org
Tue Apr 19 06:13:12 CDT 2005


"Dimitrie O. Paun" <dpaun at rogers.com> writes:

> +    EnterCriticalSection(&dibs_cs);
> +    LIST_FOR_EACH( ptr, &dibs_list )
> +    {
> +        physBitmap = LIST_ENTRY( ptr, X_PHYSBITMAP, entry );
> +        if (physBitmap->base > addr) break;

If you want to short-circuit the search this way you need to sort the
list by addresses.

> +    state = X11DRV_DIB_Lock( physBitmap, DIB_Status_None, FALSE );
> +    if (state != DIB_Status_InSync) {
> +        /* no way to tell whether app needs read or write yet, try read first */

Actually we can tell now that we have the full exception information.

> +    EnterCriticalSection( &dibs_cs );
> +    list_add_head( &dibs_list, &physBitmap->entry );
> +    if (!dibs_handler)
> +        dibs_handler = AddVectoredExceptionHandler( TRUE, X11DRV_DIB_FaultHandler );
> +    LeaveCriticalSection( &dibs_cs );

You can't hold the critsection when adding the handler since this will
grab the vectored_handlers critsection, and thus acquire the sections
in the reverse order of what happens when the handler is called.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list