Fix X 'BadPixmap' crash in Blit() with mask when GTK+ <= 2.16, closes #16303

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76626 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2014-05-30 16:29:13 +00:00
parent fa2838c120
commit 1a965c03fe
2 changed files with 9 additions and 6 deletions

View File

@@ -625,6 +625,7 @@ wxGTK:
special folder from combobox
- Fix wxSystemSettings::GetColour() returning transparent colors with GTK3.
- Fix setting client data when adding items to a sorted wxListBox.
- Fix X 'BadPixmap' crash in wxDC::Blit() with mask when GTK+ <= 2.16.
wxMSW:

View File

@@ -1199,9 +1199,8 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap,
gdk_gc_set_clip_region(use_gc, clipRegion);
// Notice that we can only release the mask now, we can't do it before
// the calls to gdk_draw_xxx() above as they crash with X error with
// GTK+ up to 2.20.1 (i.e. it works with 2.20 but is known to not work
// with 2.16.1 and below).
// the calls to gdk_draw_xxx() above as they crash with BadPixmap X
// error with GTK+ 2.16 and earlier.
if (mask_new)
g_object_unref(mask_new);
}
@@ -1311,6 +1310,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest,
GdkGC* const use_gc = m_penGC;
GdkPixmap* mask_new = NULL;
if (mask)
{
int srcMask_x = src_x;
@@ -1320,7 +1320,6 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest,
srcMask_x = source->LogicalToDeviceX(xsrcMask);
srcMask_y = source->LogicalToDeviceY(ysrcMask);
}
GdkPixmap* mask_new = NULL;
if (isScaled)
{
mask = ScaleMask(mask, srcMask_x, srcMask_y,
@@ -1343,8 +1342,6 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest,
}
gdk_gc_set_clip_mask(use_gc, mask);
gdk_gc_set_clip_origin(use_gc, dst_x - srcMask_x, dst_y - srcMask_y);
if (mask_new)
g_object_unref(mask_new);
}
GdkPixmap* pixmap = NULL;
@@ -1385,7 +1382,12 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest,
if (pixmap)
g_object_unref(pixmap);
if (mask)
{
gdk_gc_set_clip_region(use_gc, clipRegion);
// see comment at end of DoDrawBitmap()
if (mask_new)
g_object_unref(mask_new);
}
return true;
}