+ Fixed font set to const string was potentially free in

Fl_x.cxx:fl_set_spot()

+ Fixed fl_ask.h erroneous include replaced by fl_ask.H include in 
colbrowser.cxx


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6622 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Fabien Costantini 2009-01-04 16:21:42 +00:00
parent 8a53f05688
commit 601a0f0d3e
2 changed files with 11 additions and 9 deletions

View File

@ -330,6 +330,7 @@ void fl_new_ic()
XVaNestedList status_attr = NULL;
static XFontSet fs = NULL;
char *fnt;
bool must_free_fnt = true;
char **missing_list;
int missing_count;
char *def_string;
@ -342,14 +343,14 @@ void fl_new_ic()
#warning XFT support here
if (!fs) {
fnt = NULL;//fl_get_font_xfld(0, 14);
if (!fnt) fnt = "-misc-fixed-*";
if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
fs = XCreateFontSet(fl_display, fnt, &missing_list,
&missing_count, &def_string);
}
#else
if (!fs) {
fnt = fl_get_font_xfld(0, 14);
if (!fnt) fnt = "-misc-fixed-*";
if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
fs = XCreateFontSet(fl_display, fnt, &missing_list,
&missing_count, &def_string);
}
@ -431,7 +432,9 @@ void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
char **missing_list;
int missing_count;
char *def_string;
char *fnt;
char *fnt=NULL;
bool must_free_fnt=true;
static XIC ic = NULL;
if (!fl_xim_ic || !fl_is_over_the_spot) return;
@ -452,17 +455,15 @@ void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
}
#if USE_XFT
#warning XFT support here
fnt = NULL;//fl_get_font_xfld(font, size);
if (!fnt) fnt = "-misc-fixed-*";
fnt = NULL; // fl_get_font_xfld(font, size);
if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
fs = XCreateFontSet(fl_display, fnt, &missing_list,
&missing_count, &def_string);
free(fnt);
#else
fnt = fl_get_font_xfld(font, size);
if (!fnt) fnt = "-misc-fixed-*";
if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
fs = XCreateFontSet(fl_display, fnt, &missing_list,
&missing_count, &def_string);
free(fnt);
#endif
}
if (fl_xim_ic != ic) {
@ -470,6 +471,7 @@ void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
change = 1;
}
if (fnt && must_free_fnt) free(fnt);
if (!change) return;

View File

@ -32,7 +32,7 @@
#include <FL/Fl_Hold_Browser.H>
#include <FL/Fl_Box.H>
#include <FL/fl_ask.h>
#include <FL/fl_ask.H>
#include <FL/filename.H>
#include <stdlib.h>