<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>Cairo error message on exit?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>&nbsp; I'm just starting out using Cairo to replace some existing GDI/GDI+<BR>
code in Visual C++ 2010 and it seems to be working fine, but I'm getting<BR>
an error message each time I close down my application :<BR>
<BR>
&quot;First-chance exception at 0x68e629dc in CairoTest.exe: 0xC0000005:<BR>
Access violation reading location 0xabababa7&quot;<BR>
<BR>
This error only happens if I've called cairo_paint(cr) while the<BR>
application is running - if I comment this line out, it disappears.&nbsp; The<BR>
only Cairo code in my application so far is :<BR>
<BR>
CChildView::CChildView()<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp; testsurface =<BR>
cairo_image_surface_create_from_png(&quot;BlackShinyBackground.png&quot;);<BR>
}<BR>
<BR>
CChildView::~CChildView()<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp; cairo_surface_destroy(testsurface);<BR>
}<BR>
<BR>
void CChildView::OnPaint()<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp; CPaintDC dc(this);<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp; cairo_surface_t *surface = cairo_win32_surface_create(dc.m_hDC);<BR>
&nbsp;&nbsp;&nbsp;&nbsp; cairo_t *cr = cairo_create (surface);<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp; cairo_set_source_surface(cr, testsurface, 0, 0);<BR>
&nbsp;&nbsp;&nbsp;&nbsp; cairo_paint(cr);<BR>
&nbsp;&nbsp;&nbsp;&nbsp; cairo_destroy (cr);<BR>
&nbsp;&nbsp;&nbsp;&nbsp; cairo_surface_destroy (surface);<BR>
}<BR>
<BR>
Can anybody point me in the direction of what I'm doing wrong?&nbsp; It's<BR>
probably something dumb, but I'd appreciate my ignorance being pointed out.<BR>
Thanks,<BR>
Dan<BR>
</FONT>
</P>

</BODY>
</HTML>