Bug 3915 - cairo_pattern_create_for_surface should catch surface == NULL
Summary: cairo_pattern_create_for_surface should catch surface == NULL
Alias: None
Product: cairo
Classification: Unclassified
Component: image backend (show other bugs)
Version: 0.9.3
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
Depends on:
Reported: 2005-07-30 07:32 UTC by Sebastien Bacher
Modified: 2005-08-22 00:14 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Description Sebastien Bacher 2005-07-30 07:32:47 UTC
This bug is a part of the issue described by

"I'm using KDE desktop but some applications I run use cairo rendering, eg. gvim
and eclipse. Both of these (and all other cairo using apps) crash with SEGV when
I try to click on their menus or try to open any popup windows, but only if I
use gtk2-engines-gtk-qt."
Comment 1 Sebastien Bacher 2005-07-30 07:34:02 UTC
the bug happens since cairo 0.6.0. According to owen that's a qt-gtk issue but
cairo_pattern_create_for_surface should catch surface == NULL.

Backtrace of the crash:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1218722112 (LWP 18994)]
0xb774e440 in _cairo_surface_is_xlib (surface=0x0) at cairo-xlib-surface.c:1402
1402        return surface->backend == &cairo_xlib_surface_backend;
(gdb) bt
#0  0xb774e440 in _cairo_surface_is_xlib (surface=0x0) at cairo-xlib-surface.c:1402
#1  0xb774d7eb in _categorize_composite_operation (dst=0x8b5fab0,
operator=CAIRO_OPERATOR_OVER, src_pattern=0xbfe89d9c, have_mask=0)
    at cairo-xlib-surface.c:930
#2  0xb774da52 in _cairo_xlib_surface_composite (operator=CAIRO_OPERATOR_OVER,
src_pattern=0xbfe89d9c, mask_pattern=0x0, abstract_dst=0x8b5fab0, src_x=0,
    src_y=0, mask_x=0, mask_y=0, dst_x=0, dst_y=0, width=283, height=208) at
#3  0xb7738bcc in _cairo_surface_composite (operator=CAIRO_OPERATOR_OVER,
src=0xbfe89d9c, mask=0x0, dst=0x8b5fab0, src_x=0, src_y=0, mask_x=0, mask_y=0,
    dst_x=0, dst_y=0, width=283, height=208) at cairo-surface.c:712
#4  0xb772f514 in _composite_trap_region (gstate=0x8b8f4b8, src=0x8b812c8,
operator=CAIRO_OPERATOR_OVER, dst=0x8b5fab0, trap_region=0x8a53ee8,
    extents=0xbfe89e54) at cairo-gstate.c:1178
#5  0xb772fc6d in _cairo_gstate_clip_and_composite_trapezoids (gstate=0x8b8f4b8,
src=0x8b812c8, operator=CAIRO_OPERATOR_OVER, dst=0x8b5fab0,
    traps=0xbfe89ea0) at cairo-gstate.c:1424
#6  0xb772fdd2 in _cairo_gstate_fill (gstate=0x8b8f4b8, path=0x8b5fb48) at
#7  0xb7728af7 in *INT_cairo_fill_preserve (cr=0x8b5fb40) at cairo.c:1434
#8  0xb7728aa7 in cairo_fill (cr=0x8b5fb40) at cairo.c:1411
#9  0xb7af218b in gdk_window_clear_backing_rect (window=0x8b800e8, x=0, y=0,
width=283, height=208) at gdkwindow.c:1790
#10 0xb7af232d in IA__gdk_window_begin_paint_region (window=0x8b800e8,
region=0x8811e78) at gdkwindow.c:991
#11 0xb7c86265 in IA__gtk_main_do_event (event=0xbfe8a010) at gtkmain.c:1350
#12 0xb7af32be in gdk_window_process_updates_internal (window=0x8b800e8) at
#13 0xb7af3391 in IA__gdk_window_process_all_updates () at gdkwindow.c:2271
#14 0xb7af3412 in gdk_window_update_idle (data=0x0) at gdkwindow.c:2139
#15 0xb7956ad0 in g_idle_dispatch (source=0x8b618b8, callback=0xb7af33ed
<gdk_window_update_idle>, user_data=0x0) at gmain.
Comment 2 Carl Worth 2005-08-19 07:40:20 UTC
2005-08-19  Carl Worth  <cworth@cworth.org>

        Fix for bug #3915:

        * src/cairo-pattern.c: (_cairo_pattern_nil_for_status): Add new
        NULL_POINTER nil pattern.

        * src/cairo-pattern.c: (cairo_pattern_create_for_surface): Check
        for surface == NULL and return a nil pattern.

        * test/nil-surface.c: (draw): Verify that the above fix works.
Comment 3 Carl Worth 2005-08-22 17:14:08 UTC
Move bugs against "cvs" version to "0.9.3" so we can remove the "cvs" version.

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.