Comment 19 for bug 179988

Revision history for this message
ishmal (ishmalius) wrote :

Just FYI, I was digging around, and found the "handle is invalid" message source. cairo-win32_surface.c: 1719:

    if (_cairo_win32_save_initial_clip (hdc, surface) != CAIRO_STATUS_SUCCESS) {
 free (surface);

...and in _cairo_win32_save_initial_clip():

    gm = GetGraphicsMode (hdc);
    if (gm == GM_ADVANCED) {
 GetWorldTransform (hdc, &saved_xform);
 ModifyWorldTransform (hdc, NULL, MWT_IDENTITY);
    }

    clipBoxType = GetClipBox (hdc, &rect);
    if (clipBoxType == ERROR) {
 _cairo_win32_print_gdi_error ("cairo_win32_surface_create");
 SetGraphicsMode (hdc, gm);
 /* XXX: Can we make a more reasonable guess at the error cause here? */
 return _cairo_error (CAIRO_STATUS_NO_MEMORY);
    }

It's failing GetClipBox(). 'hdc' is the handle in question. They should also check 'gm' for ERROR. I bet
it's the same error.