[Bug 458169] [@font-face] implement downloadable font support on Linux

bugzilla-daemon at mozilla.org bugzilla-daemon at mozilla.org
Fri Nov 28 23:43:06 UTC 2008


Do not reply to this email.  You can add comments to this bug at
https://bugzilla.mozilla.org/show_bug.cgi?id=458169


Karl Tomlinson (:karlt) <mozbugz at karlt.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #349707|review?(roc at ocallahan.org)  |
               Flag|                            |
 Attachment #349707|0                           |1
        is obsolete|                            |




--- Comment #15 from Karl Tomlinson (:karlt) <mozbugz at karlt.net>  2008-11-28 15:42:58 PST ---
Created an attachment (id=350535)
 --> (https://bugzilla.mozilla.org/attachment.cgi?id=350535)
src:url() v1.1

* Addressed review comments.

* Changed nsIStreamLoader* arg to nsISupports* as the font entry doesn't care
what type of loader it is.

* Lazy FT_Init_FreeType to avoid a Ts regression of 10-20 ms.
(It looks like there is a Tp gain of 0.5-1% probably due to keeping a
reference to the PangoCoverage on the PangoFont.)

There is still an occasional shutdown crash that needs to be addressed.  This
happens due to cairo caching its font structures that hold a reference to the
FT_Face.  During _cairo_font_face_reset_static_data these font
structures are destroyed, during which our callback calls FT_Done_Face, but
FT_Done_FreeType has already been called from ~gfxPlatformGtk.
(FT_Done_FreeType destroys any faces not already Done).

I assume the same problem exists with the gfxFT2Fonts backend.

#4  <signal handler called>
#5  0x00007f42d4d791ad in FT_Done_Face () from /usr/lib64/libfreetype.so.6
#6  0x00007f42cc679889 in ~gfxDownloadedFcFontEntry (this=0x38eba70)
    at /home/karl/moz/dev/gfx/thebes/src/gfxPangoFonts.cpp:345
#7  0x00007f42cc66177e in gfxFontEntry::Release (this=0x38eba70)
    at ../../../dist/include/thebes/gfxFont.h:145
#8  0x00007f42cc672f69 in ReleaseDownloadedFontEntry (data=0x38eba70)
    at /home/karl/moz/dev/gfx/thebes/src/gfxPangoFonts.cpp:2669
#9  0x00007f42cc6891b4 in _cairo_user_data_array_fini (array=0x3a1a0a0)
    at /home/karl/moz/dev/gfx/cairo/cairo/src/cairo-array.c:392
#10 0x00007f42cc68b202 in *INT__moz_cairo_font_face_destroy (
    font_face=0x3a1a090)
    at /home/karl/moz/dev/gfx/cairo/cairo/src/cairo-font-face.c:206
#11 0x00007f42cc6cec11 in _cairo_ft_unscaled_font_destroy (
    abstract_font=0x3a9b1b0)
    at /home/karl/moz/dev/gfx/cairo/cairo/src/cairo-ft-font.c:519
#12 0x00007f42cc68bba6 in _cairo_unscaled_font_destroy (
    unscaled_font=0x3a9b1b0)
    at /home/karl/moz/dev/gfx/cairo/cairo/src/cairo-font-face.c:759
#13 0x00007f42cc6d14e9 in _cairo_ft_scaled_font_fini (abstract_font=0x3a15860)
    at /home/karl/moz/dev/gfx/cairo/cairo/src/cairo-ft-font.c:1739
#14 0x00007f42cc6a17b2 in _cairo_scaled_font_fini_internal (
    scaled_font=0x3a15860)
    at /home/karl/moz/dev/gfx/cairo/cairo/src/cairo-scaled-font.c:733
#15 0x00007f42cc6a17d6 in _cairo_scaled_font_fini (scaled_font=0x3a15860)
    at /home/karl/moz/dev/gfx/cairo/cairo/src/cairo-scaled-font.c:744
#16 0x00007f42cc6a0cc7 in _cairo_scaled_font_map_destroy ()
    at /home/karl/moz/dev/gfx/cairo/cairo/src/cairo-scaled-font.c:387
#17 0x00007f42cc68bbba in _cairo_font_face_reset_static_data ()
    at /home/karl/moz/dev/gfx/cairo/cairo/src/cairo-font-face.c:767
#18 0x00007f42cc68b075 in _moz_cairo_debug_reset_static_data ()
    at /home/karl/moz/dev/gfx/cairo/cairo/src/cairo-debug.c:64
#19 0x00007f42cc66901f in ~gfxPlatform (this=0x28269d0)
    at /home/karl/moz/dev/gfx/thebes/src/gfxPlatform.cpp:262
#20 0x00007f42cc6808fc in ~gfxPlatformGtk (this=0x28269d0)
    at /home/karl/moz/dev/gfx/thebes/src/gfxPlatformGtk.cpp:148
#21 0x00007f42cc6691da in gfxPlatform::Shutdown ()
    at /home/karl/moz/dev/gfx/thebes/src/gfxPlatform.cpp:249
#22 0x00007f42c8d5b5c2 in nsThebesGfxModuleDtor (self=0x2826970)
    at /home/karl/moz/dev/gfx/src/thebes/nsThebesGfxFactory.cpp:150
#23 0x00007f42d8dd5e2b in nsGenericModule::Shutdown (this=0x2826970)
    at nsGenericFactory.cpp:340
#24 0x00007f42d8dd5e55 in ~nsGenericModule (this=0x2826970)
    at nsGenericFactory.cpp:237
#25 0x00007f42d8dd5fe7 in nsGenericModule::Release (this=0x2826970)
    at nsGenericFactory.cpp:245
#26 0x00007f42d8e3c8bf in nsCOMPtr<nsIModule>::assign_assuming_AddRef (
    this=0x28755d0, newPtr=0x0) at ../../dist/include/xpcom/nsCOMPtr.h:495
#27 0x00007f42d8e3c954 in nsCOMPtr<nsIModule>::assign_with_AddRef (
    this=0x28755d0, rawPtr=0x0) at ../../dist/include/xpcom/nsCOMPtr.h:1171
#28 0x00007f42d8e3f4d1 in nsCOMPtr<nsIModule>::operator= (this=0x28755d0,
    rhs=0x0) at ../../dist/include/xpcom/nsCOMPtr.h:640
#29 0x00007f42d8e3eb0a in nsNativeModuleLoader::ReleaserFunc (
    aHashedFile=0x2824528, aLoadData=@0x28755d0)
    at /home/karl/moz/dev/xpcom/components/nsNativeComponentLoader.cpp:219
#30 0x00007f42d8e3f320 in nsBaseHashtable<nsHashableHashKey,
nsNativeModuleLoader::NativeLoadData,
nsNativeModuleLoader::NativeLoadData>::s_EnumStub (
    table=0x239c5f0, hdr=0x28755c0, number=4, arg=0x7fffe21b6300)
    at ../../dist/include/xpcom/nsBaseHashtable.h:346
#31 0x00007f42d8dc4961 in PL_DHashTableEnumerate (table=0x239c5f0,
    etor=0x7f42d8e3f2c8 <nsBaseHashtable<nsHashableHashKey,
nsNativeModuleLoader::NativeLoadData,
nsNativeModuleLoader::NativeLoadData>::s_EnumStub(PLDHashTable*,
PLDHashEntryHdr*, unsigned int, void*)>, arg=0x7fffe21b6300)
    at pldhash.c:735
#32 0x00007f42d8e3f3a4 in nsBaseHashtable<nsHashableHashKey,
nsNativeModuleLoader::NativeLoadData,
nsNativeModuleLoader::NativeLoadData>::Enumerate (
    this=0x239c5f0,
    enumFunc=0x7f42d8e3eae8 <nsNativeModuleLoader::ReleaserFunc(nsIHashable*,
nsNativeModuleLoader::NativeLoadData&, void*)>, userArg=0x0)
    at ../../dist/include/xpcom/nsBaseHashtable.h:221
#33 0x00007f42d8e3eacd in nsNativeModuleLoader::UnloadLibraries (
    this=0x239c5e8)
    at /home/karl/moz/dev/xpcom/components/nsNativeComponentLoader.cpp:258
#34 0x00007f42d8e38484 in nsComponentManagerImpl::Shutdown (this=0x239c530)
    at /home/karl/moz/dev/xpcom/components/nsComponentManager.cpp:747
#35 0x00007f42d8ddac3c in NS_ShutdownXPCOM_P (servMgr=0x0)
    at /home/karl/moz/dev/xpcom/build/nsXPComInit.cpp:843

Possible solutions are

1) Check whether FT_Done_FreeType has been called before calling FT_Done_Face.
   This may be fairly simple, but its ugly leaving the reference to the
   FT_Face in cairo's caches.

2) Be more careful about shutdown order.  Some things will need to be shutdown
   before _cairo_font_face_reset_static_data and some after.

3) Use a refcounted object count references to the FT_Library (whenever an
   FT_Face is created or destroyed) and call FT_Done_FreeType when these reach
   zero.

-- 
Configure bugmail: https://bugzilla.mozilla.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.




More information about the Fedora-fonts-bugs-list mailing list