[cairo-bugs] [Bug 4692] New: _global_image_glyph_cache_mutex is not
initialized in win32 + static builds
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed Oct 5 06:38:41 PDT 2005
Please do not reply to this email: if you want to comment on the bug, go to
the URL shown below and enter yourcomments there.
https://bugs.freedesktop.org/show_bug.cgi?id=4692
Summary: _global_image_glyph_cache_mutex is not initialized in
win32 + static builds
Product: cairo
Version: 1.0.2
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: critical
Priority: P2
Component: win32 backend
AssignedTo: otaylor at redhat.com
ReportedBy: ono at java.pl
QAContact: cairo-bugs at cairographics.org
Uninitialized _global_image_glyph_cache_mutex at win32 platform causes access
violation at cairo-font.c.
Moreover since Win32 mutex needs to be initialized prior using all of them are
initialized in DllMain() which does the job well on shared library system but
not on static build.
I propose 2 functions
cairo_win32_init()
cairo_win32_release()
That should be called in win32 static build to initialize mutex variables.
Please use following code snippet from cairo-win32-surface.c:
---
/*
* Without pthread, on win32 we need to initialize all the 'mutex'es
* before use. It is guaranteed that DllMain will get called single
* threaded before any other function.
* Initializing more than finally needed should not matter much.
*/
#ifndef HAVE_PTHREAD_H
BOOL WINAPI
DllMain (HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
/* every 'mutex' from CAIRO_MUTEX_DECALRE needs to be initialized here */
cairo_win32_init ();
break;
case DLL_PROCESS_DETACH:
cairo_win32_release ();
break;
}
return TRUE;
}
CRITICAL_SECTION cairo_toy_font_face_hash_table_mutex;
CRITICAL_SECTION cairo_scaled_font_map_mutex;
CRITICAL_SECTION cairo_ft_unscaled_font_map_mutex;
CRITICAL_SECTION _global_image_glyph_cache_mutex;
void
cairo_win32_init ()
{
/* every 'mutex' from CAIRO_MUTEX_DECALRE needs to be initialized here */
InitializeCriticalSection (&cairo_toy_font_face_hash_table_mutex);
InitializeCriticalSection (&cairo_scaled_font_map_mutex);
InitializeCriticalSection (&cairo_ft_unscaled_font_map_mutex);
InitializeCriticalSection (&_global_image_glyph_cache_mutex);
}
void
cairo_win32_release ()
{
DeleteCriticalSection (&cairo_toy_font_face_hash_table_mutex);
DeleteCriticalSection (&cairo_scaled_font_map_mutex);
DeleteCriticalSection (&cairo_ft_unscaled_font_map_mutex);
DeleteCriticalSection (&_global_image_glyph_cache_mutex);
}
#endif
---
Regards,
Adam Strzelecki
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
More information about the cairo-bugs
mailing list