Bug 57493

Summary: Win32Surface crashes
Product: pycairo Reporter: Dont-spam-me <fghfjgfgdfgfgfg>
Component: generalAssignee: Steve Chaplin <d74n5pohf9>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: fghfjgfgdfgfgfg
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:

Description Dont-spam-me 2012-11-24 19:32:01 UTC
Hi, 

I think cairo.Win32Surface(dc) crashes under 64-bit Python v2.7.2 *probably* due to the fact that a DC handle is a long int which Win32Surface could not handle.

This is just my guess, hope someone could verify.

I used a PDFSurface instead and it works perfectly fine.
Comment 1 Dont-spam-me 2012-11-24 19:35:16 UTC
Here is a sample code to reproduce the crash:

import cairo
from win32api import *
from win32gui import *

dc = CreateCompatibleDC(0) # 0 means compatible with screen
bm = CreateCompatibleBitmap(dc, 100, 100)
old = SelectObject(dc, bm)
s = cairo.Win32Surface(dc) # crashes here

You can verify that 'dc' is non-NULL and is a long int.
Comment 2 Dont-spam-me 2013-02-09 14:50:38 UTC
don't want my email addr to appear in public
Comment 3 Christoph Reiter 2017-07-05 15:16:26 UTC
Fixed since 1.11: https://pycairo.readthedocs.io/en/latest/changelog.html#v1-11-0

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.