+
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/FvwmPager/FvwmPager.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ bool HilightDesks = true;
bool HilightLabels = true;
bool error_occured = false;
bool use_desk_label = true;
bool use_window_label = true;
bool WindowBorders3d = false;
bool HideSmallWindows = false;
bool SendCmdAfterMove = false;
Expand Down
1 change: 1 addition & 0 deletions modules/FvwmPager/FvwmPager.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ extern bool HilightDesks;
extern bool HilightLabels;
extern bool error_occured;
extern bool use_desk_label;
extern bool use_window_label;
extern bool WindowBorders3d;
extern bool HideSmallWindows;
extern bool SendCmdAfterMove;
Expand Down
45 changes: 36 additions & 9 deletions modules/FvwmPager/init_pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,14 @@ void initialize_fonts(void)
/* Initialize fonts. */
FlocaleInit(LC_CTYPE, "", "", "FvwmPager");

/* load a default font. */
Scr.Ffont = FlocaleLoadFont(dpy, NULL, MyName);
/* load default fonts. */
Scr.Ffont = NULL;
Scr.winFfont = NULL;
Balloon.Ffont = NULL;

/* balloons are not shown by default */
Balloon.show_in_pager = false;
Balloon.show_in_icon = false;

/* init our Flocale window string */
FlocaleAllocateWinString(&FwinString);
Expand Down Expand Up @@ -373,6 +379,12 @@ void initialize_pager_size(void)
int VxPages = fp->virtual_scr.VxPages;
int VyPages = fp->virtual_scr.VyPages;

if (use_window_label && !Scr.winFfont)
Scr.winFfont = FlocaleLoadFont(dpy, NULL, MyName);

if ((use_desk_label || use_monitor_label) && !Scr.Ffont)
Scr.Ffont = FlocaleLoadFont(dpy, NULL, MyName);

/* Grid size */
if (Rows < 0)
{
Expand Down Expand Up @@ -1118,12 +1130,14 @@ void parse_options(void)
icon_yneg = true;
}
} else if (StrEquals(resource, "Font")) {
if (strncasecmp(next, "none", 4) == 0) {
FlocaleUnloadFont(dpy, Scr.Ffont);
if (strncasecmp(next, "none", 4) != 0)
Scr.Ffont = FlocaleLoadFont(
dpy, next, MyName);
else {
Scr.Ffont = NULL;
use_desk_label = false;
use_monitor_label = false;
} else {
FlocaleUnloadFont(dpy, Scr.Ffont);
Scr.Ffont = FlocaleLoadFont(dpy, next, MyName);
Comment on lines -1121 to -1126
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the reason @ThomasAdam got a segfault and will cause other segfaults. Scr.Ffont is expected to be a valid font in the code, so that is why it was explicitly not unloaded with the None setting. You are unloading the font when it shouldn't be.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is not possible. All references to Scr.Ffont are either guarded by use_desk_label or use_monitor_label, or are inside draw_desk_label() all calls of which are guarded by use_desk_label or use_monitor_label, hence this cannot cause a crash. I wrote previously why @ThomasAdam got a crash.

}
} else if (StrEquals(resource, "Pixmap") ||
StrEquals(resource, "DeskPixmap"))
Expand Down Expand Up @@ -1187,9 +1201,15 @@ void parse_options(void)
StrEquals(resource, "SmallFont"))
{
FlocaleUnloadFont(dpy, Scr.winFfont);
if (strncasecmp(next, "none", 4) != 0)
if (strncasecmp(next, "none", 4) != 0) {
Scr.winFfont = FlocaleLoadFont(
dpy, next, MyName);
if (Scr.winFfont)
use_window_label=true;
} else {
Scr.winFfont = NULL;
use_window_label=false;
}
} else if (StrEquals(resource, "Rows")) {
sscanf(next, "%d", &Rows);
} else if (StrEquals(resource, "Columns")) {
Expand Down Expand Up @@ -1237,8 +1257,15 @@ void parse_options(void)
Balloon.show_in_icon = true;
}
} else if (StrEquals(resource, "BalloonFont")) {
FlocaleUnloadFont(dpy, Balloon.Ffont);
Balloon.Ffont = FlocaleLoadFont(dpy, next, MyName);
FlocaleUnloadFont(dpy, Balloon.Ffont);
if (strncasecmp(next, "none", 4) != 0) {
Balloon.Ffont = FlocaleLoadFont(
dpy, next, MyName);
} else {
Balloon.Ffont = NULL;
Balloon.show_in_pager = false;
Balloon.show_in_icon = false;
}
} else if (StrEquals(resource, "BalloonBorderWidth")) {
sscanf(next, "%d", &(Balloon.border_width));
} else if (StrEquals(resource, "BalloonYOffset")) {
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载