Bug 57493 - Win32Surface crashes
Summary: Win32Surface crashes
Alias: None
Product: pycairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Steve Chaplin
QA Contact:
Depends on:
Reported: 2012-11-24 19:32 UTC by Dont-spam-me
Modified: 2017-07-05 15:16 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


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

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.