WMCreateFont() was calling exit() if it could not create the
font, and was trying too hard not to return NULL.
Just return NULL if the font could not be created instead of exit()ing
and let callers decide what to do upon failure.
Thanks to Christian <chris@computersalat.de> for reporting this.
for arq in `git ls-files *.c`; do
echo $arq;
indent -linux -l115 $arq;
done
The different line break at 115 columns is because
I use a widescreen monitor :-)
WPrefs tries to use the fonts listed in the WMCreateFont() call (from WPrefs.c),
font = WMCreateFont(scr, "Lucida Sans,URW Gothic L,Times New Roman,serif"
":bold:pixelsize=26:antialias=true");
and 'font' is later used without accounting the possibility of it being NULL in
WMSetLabelFont(WPrefs.nameL, font);
WMReleaseFont(font);
In particular, WMReleaseFont(font) will kill WPrefs ungracefully with the
following message if font=NULL
WPrefs: wfont.c:193: WMReleaseFont: Assertion `font!=((void *)0)' failed.
Aborted
That happens because the return value of WMCreateFont() can be NULL, so this
patch makes WMCreateFont() never return NULL. If the font creation fails for
some reason (see below), we try to use the emergency DEFAULT_FONT and print
debugging information telling what's going on. If the use of DEFAULT_FONT
also fails, then we terminate WPrefs with exit(1) and let the user know
why exactly if failed.
This bug happened because the font "Lucida Sans" (the first possibility
in the initial call to WMCreateFont()) "exists" in my system as a stale
symbolic link to a location which no longer exists after an upgrade from
java from 1.5.0.14 to 1.5.0.15
/etc/alternatives/LucidaSansDemiBold.ttf ->
/usr/lib/jvm/java-1.5.0-sun-1.5.0.14/jre/lib/fonts/LucidaSansDemiBold.ttf
So the call to XftFontOpenName(display, scrPtr->screen, fname) with
"Lucida Sans" being the first possibility for Xft to try out ended up in 'font'
being NULL because, as far as the Xft library was concerned, "Lucida Sans"
produced a positive match (due to it existing as a symbolic link) but in the end
a NULL result was produced due to the missing symbolic link destination. This later
exposed the bug of WMCreateFont() returning font=NULL and WPrefs.c not checking
whether font=NULL before using it. Bang!
If "Lucida Sans" was the _second_ entry to try and the first one had suceeded,
this bug would not have surfaced.
This solves https://qa.mandriva.com/show_bug.cgi?id=39677
Signed-off-by: Carlos R. Mafra <crmafra@ift.unesp.br>
- Fixed convertfonts to account for $LANG
- Fixed convertfonts logic a bit and no longer output slant and weight if
they are the default ones (medium and roman)
- Applied Pascal's fix for GNUstep menus (modified to also include submenus)
Still this is not the proper fix, as it can't differentiate between
submenus and other windows at the floating window level. Correct fix needs
some extra hints to be set by GNUstep on menus.
This was we internally only deal with fc names and properties. It will
incur a small performance hit as the font needs to be parsed/unparsed,
but this is only for backward-compatibility to support old xlfd names.
People are encouraged to swtich to fontconfig names.
- WINGs no longer adds sans as a fallback for internal fonts. It is
automatically done by fontconfig (if it can't find the requested font
it will use the closest match which is the default font: sans-serif)
- Added code to honor the AntialiasesText global option
- Fixed style names for WMCopyFontWithStyle()
- Added fonts in style files where they were missing. Also changed some
fonts to better defaults.
- Fixed bug in icon chooser dialog that could cause a segmentation fault
in some cases (Pascal Hofstee <caelian@gmail.com>)
- Fixed crash in asm code in wrlib, with new versions of gcc.
- Fixed bug in the x86_PseudoColor_32_to_8() function which incorrectly
used the r, g, b fields in the conversion.
- Fixed x86 ASM code in wrlib to work on 64 bit architectures.
- Fixed the focus flicker seen with some apps (notably gtk2)
(Alexey Spiridonov <snarkmaster@gmail.com>)
- Fixed all crashing bugs that were generated by wmaker starting with the
WMState file missing.
- Added NetWM support (a modified version of the patch originaly written
by Peter Zijlstra <a.p.zijlstra@chello.nl>)
- Applied patch to enhance the Virtual Desktop behaviour, and to integrate
it with the NetWM code (Peter Zijlstra <a.p.zijlstra@chello.nl>)
- Applied a few xinerama and placement fixes (Peter Zijlstra
<a.p.zijlstra@chello.nl>)
- Fixed memory leak in dock code.
- Fixed and enhanced the text wrapping in WINGs.
- Fixed the layout of some elements in WPrefs.app
- Added workaround for aplications that don't set the required hints on the
client leader window, but they set them on normal windows (observer with
KDE 3.3.0 mainly). This will allow these apps to get an appicon again.
(they should be fixed still)
- Added workaround for applications that do not set a command with
XSetCommand(), but instead they set the _NET_WM_PID property. This works
with operating systems that offer a /proc interface similar to what linux
has. (This also is to fix problems with KDE 3.3.0 apps, but not only them).
- Fixed bug with autostart and exit scripts not being executed if user
GNUstep path was different from ~/GNUstep (when setting GNUSTEP_USER_ROOT)
- Added utf8 support in WINGs (removed old X core font code)
- Added utility to convert old font names to new font names in style files
fonts and X font sets.
- New code operates on new fontnames like Arial-8:bold:italic in place of xlfd
(WMCreateFont can still read an xlfd for back compat)
to replace WMNormalizeFont(), WMEmphasizeFont(), WMStrenghtenFont(),
WMUnemphasizeFont() and WMUnstrenghtenFont() which are now obsolete and
were removed.
marked not to be synchronized.
- WMGLOBAL options can now be set in the WindowMaker configuration files
to overwrite values in WMGLOBAL.
- You can now pass "SystemFont", "BoldSystemFont", "SystemFont-##" or
"BoldSystemFont-##", with ## being the font size to any font creating
function to create a font with the (bold) system font font specification.
- Replaced AA with Anitialiased in WINGs font creation function names
- Added WMCreateFontWithFlags(), WMHasAntialiasingSupport() and
WMIsAntialiasingEnabled()
- Created a separate font cacahe for antialiased fonts
- Added test at startup if Xft supports rendering antialiased fonts (in case
the application was compiled with Xft support, but is run on an X server
without support for xft rendering (RENDER extension missing). If no Xft
support antialiasing will be disabled even if it is enabled in the
configuration file.
- Finished the Info Panel to work with antialiased fonts.
- Code cleanup in dialog.c. Remade part of Info Panel drawing the Window Maker
logo.
- Fixed technical style drawing of window resizing.
are affected. Fixes for old code too.
- Double buffering in WMList. All widgets or apps using WMList and
having user drawing porcedures in place will inherit this double
buffering automatically too.
- New functions in WINGs: WMGetColorAlpha(), WMIsAAFont()
- Misc code cleanups in WINGs and src/dialog.c
flickering.
- Added double buffering when drawing WMList items to avoid flickering
- Shared xft drawable
- Renamed AASystemFont and AABoldSystemFont to AntialiasedSystemFont
respectively AntialiasedBoldSystemFont in WMGLOBAL
- WMCreateFont falls back to normal fonts if antialiased fonts cannot be
created (even if enabled)
WMDrawString() and WMDrawImageString() now take WMColor instead of GC as
arguments. WMDrawImageString() receives 2 colors (text & background).
This is to allow easy extension for Xft/Xrender and hide X low level details
- Added alpha channel to WMColor. 2 new functions also:
WMCreateRGBAColor() and WMSetColorAlpha()
- Miscelaneous code cleanups in wtext.c
- Removed obsoleted acconfig.h and implemented its functionality using
AC_DEFINE and AC_DEFINE_UNQUOTED as autoconf 2.5x recommends.
This will definitely enforce the need to use autoconf 2.5x
- Separated the font caches for normal fonts and fontsets in WINGs (they can
have the same names and collide in the cache giving unwanted results)
- Updated the years in the copyright notices