Bug 5945

Summary: Context.getFontOptions() seg faults
Product: cairo-java Reporter: Remy Suen <remy.suen>
Component: generalAssignee: Igor Foox <ifoox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch to initialize the pointer before passing it to the function.

Description Remy Suen 2006-02-19 11:21:09 UTC
The code below causes a segfault in the application.

ImageSurface surface = new ImageSurface(Format.ARGB32, 300, 200);
Context context = new Context(surface);
context.getFontOptions();
Comment 1 Remy Suen 2006-02-19 11:32:06 UTC
Created attachment 4670 [details] [review]
Patch to initialize the pointer before passing it to the function.

If you were to change the application to something like:

ImageSurface surface = new ImageSurface(Format.ARGB32, 300, 200);
Context context = new Context(surface);
FontOptions options = new FontOptions();
context.setFontOptions(options);
FontOptions get = context.getFontOptions();
// returns true
// we are calling a function from the Cairo API here
options.equal(get);
// returns false
// we are calling the Java method we have defined in org.gnu.glib.Struct here
options.equals(get);

I don't know if the second part returning false is okay or not. Even if we were
to create a static factory method like we do in a multitude of the classes we
have in the gtk+ bindings, the handles would still be different since we're
instantiating a new cairo_font_options_t every single time. Despite the fact
that we're using a GC-based language, this still worries me a bit.
Comment 2 Dan Williams 2006-03-24 03:34:58 UTC
Fixed as part of commit for http://bugzilla.gnome.org/show_bug.cgi?id=335300

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.