Bug 101833 - Inkscape crashes with "Assertion failed", " ! surface->unbounded" when printing
Summary: Inkscape crashes with "Assertion failed", " ! surface->unbounded" when printing
Status: RESOLVED MOVED
Alias: None
Product: cairo
Classification: Unclassified
Component: win32 backend (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: cairo-bugs mailing list
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-18 23:35 UTC by Eduard Braun
Modified: 2018-08-25 13:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
patch which fixes printing on win32 and avoids the unbounded surface assertion error (784 bytes, patch)
2017-07-18 23:37 UTC, Eduard Braun
Details | Splinter Review
patch v2 (1.08 KB, patch)
2017-07-26 19:48 UTC, Eduard Braun
Details | Splinter Review

Description Eduard Braun 2017-07-18 23:35:43 UTC
Inkscape currently crashes on win32 when printing with the following error, see [1] for details:

  Assertion failed!

  Program: E:\Temp\Inkscape\inkscape.git\trunk\build64\inkscape\inkscape.exe
  File: ../../cairo-1.15.6/src/cairo-recording-surface.c, Line 608

  Expression: ! surface->unbounded


While trying to debug this I found a recent commit [2] addressing a similar issue which was reported on the mailing list [3].


Investigating further I found the same code which [2] replaced in a second location in the affected file. Out of desperation I tried to apply the patch here, too (see attached patch) and what can I say - Inkscape doesn't crash anymore and prints correctly!

I honestly have no experience with cairo whatsoever and don't really know what I did here, but I hope somebody can check if my change makes any sense and whether it's a correct fix for the issue I was seeing.



[1] https://bugs.launchpad.net/inkscape/+bug/1665768
[2] https://cgit.freedesktop.org/cairo/commit/?id=90d50cd92315d6760069ad8062aba5e297370b20
[3] https://lists.cairographics.org/archives/cairo/2016-June/027445.html
Comment 1 Eduard Braun 2017-07-18 23:37:06 UTC
Created attachment 132752 [details] [review]
patch which fixes printing on win32 and avoids the unbounded surface assertion error
Comment 2 Uli Schlachter 2017-07-20 13:42:34 UTC
Adrian, could you comment on this? I don't understand the attached patch nor https://cgit.freedesktop.org/cairo/commit/?id=90d50cd92315d6760069ad8062aba5e297370b20

__cairo_surface_is_recording checks if surface->backend->type is CAIRO_SURFACE_TYPE_RECORDING while both patches check surface->type instead. Why/how do we end up having recording surfaces which have a non-recording backend? Why does _cairo_surface_is_recording not recognize them? Wouldn't it be better to fix this function instead?
Comment 3 Adrian Johnson 2017-07-21 10:50:47 UTC
Patch looks goods. From memory it was something to do with cairo_surface_is_recording() not recognizing snapshots of recordings as a recording surface.
Comment 4 Eduard Braun 2017-07-21 11:20:27 UTC
Thanks for review!

In this case I feel safe to use a patched build of cairo until this makes it into a release.


I found one additional use of _cairo_surface_is_recording in function surface_pattern_supported:
https://cgit.freedesktop.org/cairo/tree/src/win32/cairo-win32-printing-surface.c#n338
Should this one be patched, too, then?
Comment 5 Adrian Johnson 2017-07-21 12:38:28 UTC
> I found one additional use of _cairo_surface_is_recording in function
> surface_pattern_supported:
> https://cgit.freedesktop.org/cairo/tree/src/win32/cairo-win32-printing-
> surface.c#n338
> Should this one be patched, too, then?

I think so. I don't have a windows build environment setup to test it.
Comment 6 Eduard Braun 2017-07-26 19:48:21 UTC
Created attachment 133001 [details] [review]
patch v2

So here's the patch with both occurrences replaced.

Is there anything else I can do on my end at this time?
Comment 7 Bryce Harrington 2017-09-20 21:23:49 UTC
I am still curious about the questions Uli mentioned in comment #2.  If the backend for the snapshotted surface is not CAIRO_SURFACE_TYPE_RECORDING, what is it?  Would it be possible to fix _cairo_surface_is_recording to properly test for that?
Comment 8 GitLab Migration User 2018-08-25 13:40:40 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/131.


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.