Bug 12026 - missing unlocks in src/* (font related)
Summary: missing unlocks in src/* (font related)
Status: RESOLVED MOVED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.5.1
Hardware: Other All
: medium normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2007-08-16 02:50 UTC by Roland "Test-tools" Bär
Modified: 2018-08-25 13:38 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
For src/cairo-ft-font.c (1.16 KB, patch)
2007-08-16 02:54 UTC, Roland "Test-tools" Bär
Details | Splinter Review
For src/cairo-ft-font.c (1.59 KB, patch)
2007-08-16 02:55 UTC, Roland "Test-tools" Bär
Details | Splinter Review
For src/cairo-type1-subset.c (919 bytes, patch)
2007-08-16 02:58 UTC, Roland "Test-tools" Bär
Details | Splinter Review

Description Roland "Test-tools" Bär 2007-08-16 02:50:02 UTC
Found that missing unlocks, triggered by errors.

3 patches attached.
Comment 1 Roland "Test-tools" Bär 2007-08-16 02:54:02 UTC
Created attachment 11151 [details] [review]
For src/cairo-ft-font.c
Comment 2 Roland "Test-tools" Bär 2007-08-16 02:55:20 UTC
Created attachment 11152 [details] [review]
For src/cairo-ft-font.c
Comment 3 Roland "Test-tools" Bär 2007-08-16 02:58:59 UTC
Created attachment 11153 [details] [review]
For src/cairo-type1-subset.c
Comment 4 Chris Wilson 2007-08-16 03:27:20 UTC
Calling _cairo_ft_unscaled_font_unlock_face() after an error encountered during _cairo_ft_unscaled_font_lock_face() is wrong as the error path within lock_face() has already released the unscaled->mutex. Error paths are supposed to perform all necessary cleanup, but reading lock_face() it appears to be falsely incrementing unscaled->lock_count after an error. (And it looks like font_map->num_open_faces++ should be using an atomic op instead.)

diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 4dc61ee..04441d0 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -552,6 +552,7 @@ _cairo_ft_unscaled_font_lock_face (cairo_ft_unscaled_font_t 
                     unscaled->id,
                     &face) != FT_Err_Ok)
     {
+       unscaled->lock_count--;
        CAIRO_MUTEX_UNLOCK (unscaled->mutex);
        _cairo_error (CAIRO_STATUS_NO_MEMORY);
        return NULL;
Comment 5 GitLab Migration User 2018-08-25 13:38:18 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/112.


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.