unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21152: emacs make system blocked if "Xft/DPI = -1" in xsettings
@ 2015-07-28  5:58 Xu Fasheng
  2015-08-09  5:10 ` Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: Xu Fasheng @ 2015-07-28  5:58 UTC (permalink / raw)
  To: 21152

Hi, everyone.

I found that emacs could not compute a right dpi value if "Xft/DPI =
-1" in xsettings. The document said "Xft/DPI" is an integer, and "-1"
is the default value [1].

And in the code of src/xsettings.c:parse_settings(), all the interger
value in xsettings are converted to CARD32(unsigned int). So if
Xft/DPI is "-1", emacs will convert it to uint(4294967295), and owns a
huge dpi(4294967295/1024=4194303). Its so huge that will make system
blocked.

Here is the code snippets in
emacs24-24.5+1/src/xsettings.c:parse_settings() from debian/sid:
    ....
    420: CARD32 vlen, ival = 0;
    ....
    544: else if (strcmp (name, "Xft/DPI") == 0)
    545:  {
    546:    settings->seen |= SEEN_DPI;
    547:    settings->dpi = (double)ival/1024.0;
    548:  }

[1] http://www.freedesktop.org/wiki/Specifications/XSettingsRegistry/





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#21152: emacs make system blocked if "Xft/DPI = -1" in xsettings
  2015-07-28  5:58 bug#21152: emacs make system blocked if "Xft/DPI = -1" in xsettings Xu Fasheng
@ 2015-08-09  5:10 ` Paul Eggert
       [not found]   ` <CA+TDsSnFnUdwf4UsrSG2fF0o8dr5YLBhN8W1cWmMz7r6-Z_KWA@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2015-08-09  5:10 UTC (permalink / raw)
  To: Xu Fasheng; +Cc: 21152

[-- Attachment #1: Type: text/plain, Size: 77 bytes --]

Thanks for the bug report.  Does the attached patch fix the problem for you?

[-- Attachment #2: xftdpi.diff --]
[-- Type: text/x-diff, Size: 495 bytes --]

diff --git a/src/xsettings.c b/src/xsettings.c
index 028487b..e59bea2 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -537,7 +537,7 @@ parse_settings (unsigned char *prop,
               else
                 settings->seen &= ~SEEN_RGBA;
             }
-          else if (strcmp (name, "Xft/DPI") == 0)
+          else if (strcmp (name, "Xft/DPI") == 0 && ival != (CARD32) -1)
             {
               settings->seen |= SEEN_DPI;
               settings->dpi = (double)ival/1024.0;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#21152: emacs make system blocked if "Xft/DPI = -1" in xsettings
       [not found]   ` <CA+TDsSnFnUdwf4UsrSG2fF0o8dr5YLBhN8W1cWmMz7r6-Z_KWA@mail.gmail.com>
@ 2015-08-10  6:24     ` Paul Eggert
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2015-08-10  6:24 UTC (permalink / raw)
  To: Xu Fasheng; +Cc: 21152-done

Xu Fasheng wrote:
> tha patch works. I rebuild emacs and tested ok.

Thanks, I installed it in the Emacs master and am marking this as done.






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-10  6:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28  5:58 bug#21152: emacs make system blocked if "Xft/DPI = -1" in xsettings Xu Fasheng
2015-08-09  5:10 ` Paul Eggert
     [not found]   ` <CA+TDsSnFnUdwf4UsrSG2fF0o8dr5YLBhN8W1cWmMz7r6-Z_KWA@mail.gmail.com>
2015-08-10  6:24     ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).