Subject: Re: GDK_SCALE=2 GDK_DPI_SCALE=0.5 destroys GTK+ 3 scroll bar

From: Paul Eggert <[email-masked]>
Date: Thu, 14 May 2015 19:59:31 -0700

Jan D. wrote:
>> By the way, on my Fedora 21 x86-64 host, setting GDK_SCALE=2
>> GDK_DPI_SCALE=0.5 has no effect on emacs -Q, even with the recent
>> fixes.  Perhaps this is due to the races you mentioned?
>
> No, that just affects the initial frame size.
> You should see an effect on toolbar and scroll bar size (they should be twice as
> big).

Yes, you're right, it works.  I had misconfigured my Emacs (configured with the 
Lucid toolkit).  Sorry about the confusion.

I suppose I should mention that when I tried a properly-configured Emacs with 
GDK_SCALE=2 it dumped core for me.  I was running on Fedora 21 x86-64 (which has 
gtk3-3.14.13-1.fc21.x86_64) and displaying over the Internet to Ubuntu 15.04.  I 
can't reproduce the problem so it could be a timing thing.  The core dump occurs 
within gtk_window_get_size, which is called by xg_frame_set_char_size.   I 
wasn't running under a debugger, so I got only this backtrace:

> $ GDK_SCALE=2 src/emacs -Q
> X protocol error: BadAccess (attempt to access private resource denied) on protocol request 130
> When compiled with GTK, Emacs cannot recover from X disconnects.
> This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715
> For details, see etc/PROBLEMS.
> Fatal error 6: Aborted
> Backtrace:
> src/emacs[0x503bc2]
> src/emacs[0x4ebb09]
> src/emacs[0x503c53]
> src/emacs[0x4be78e]
> src/emacs[0x4c2a28]
> src/emacs[0x4c2a8d]
> /lib64/libX11.so.6(_XError+0x11d)[0x7f0edfd1d4dd]
> /lib64/libX11.so.6(+0x42427)[0x7f0edfd1a427]
> /lib64/libX11.so.6(+0x424e5)[0x7f0edfd1a4e5]
> /lib64/libX11.so.6(_XReply+0x230)[0x7f0edfd1b490]
> /lib64/libX11.so.6(XGetGeometry+0x8e)[0x7f0edfcffd9e]
> /lib64/libgdk-3.so.0(+0x5d37f)[0x7f0ee1b7537f]
> /lib64/libgdk-3.so.0(gdk_window_get_geometry+0x104)[0x7f0ee1b4e014]
> /lib64/libgdk-3.so.0(gdk_screen_get_monitor_at_window+0x8f)[0x7f0ee1b4974f]
> /lib64/libgtk-3.so.0(+0x332d79)[0x7f0ee2104d79]
> /lib64/libgtk-3.so.0(+0x3367fb)[0x7f0ee21087fb]
> /lib64/libgtk-3.so.0(gtk_window_get_size+0xab)[0x7f0ee210e88b]
> src/emacs[0x4ddff8]
> src/emacs[0x4c94fa]
> src/emacs[0x4273b0]
> src/emacs[0x4d2829]
> src/emacs[0x55bb33]
> src/emacs[0x58ecb3]
> src/emacs[0x55b57f]
> src/emacs[0x55b94b]
> src/emacs[0x58ecb3]
> src/emacs[0x55b94b]
> src/emacs[0x58ecb3]
> src/emacs[0x55b94b]
> src/emacs[0x58ecb3]
> src/emacs[0x55b94b]
> src/emacs[0x58ecb3]
> src/emacs[0x55aa08]
> src/emacs[0x55ad0b]
> src/emacs[0x55e2d1]
> src/emacs[0x55a107]
> src/emacs[0x4ee8ac]
> src/emacs[0x559fe3]
> src/emacs[0x4ebf08]
> src/emacs[0x4f04bb]
> src/emacs[0x4f0808]
> ...
> Aborted (core dumped)

Addrline converts this to:

emacs_backtrace at /home/eggert/src/gnu/emacs/static-checking/src/sysdep.c:2188
terminate_due_to_signal at 
/home/eggert/src/gnu/emacs/static-checking/src/emacs.c:374
emacs_abort at /home/eggert/src/gnu/emacs/static-checking/src/sysdep.c:2201
x_connection_closed at /home/eggert/src/gnu/emacs/static-checking/src/xterm.c:8525
x_error_quitter at /home/eggert/src/gnu/emacs/static-checking/src/xterm.c:8617
x_error_handler at /home/eggert/src/gnu/emacs/static-checking/src/xterm.c:8588
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
xg_clear_under_internal_border at 
/home/eggert/src/gnu/emacs/static-checking/src/gtkutil.c:848
  (inlined by) xg_frame_set_char_size at 
/home/eggert/src/gnu/emacs/static-checking/src/gtkutil.c:947
x_set_window_size at /home/eggert/src/gnu/emacs/static-checking/src/xterm.c:9729
adjust_frame_size at /home/eggert/src/gnu/emacs/static-checking/src/frame.c:491 
(discriminator 8)
Fx_create_frame at /home/eggert/src/gnu/emacs/static-checking/src/xfns.c:3305
Ffuncall at /home/eggert/src/gnu/emacs/static-checking/src/eval.c:2719
exec_byte_code at /home/eggert/src/gnu/emacs/static-checking/src/bytecode.c:919
funcall_lambda at /home/eggert/src/gnu/emacs/static-checking/src/eval.c:2957
backtrace_debug_on_exit at /home/eggert/src/gnu/emacs/static-checking/src/eval.c:159
  (inlined by) Ffuncall at 
/home/eggert/src/gnu/emacs/static-checking/src/eval.c:2791
exec_byte_code at /home/eggert/src/gnu/emacs/static-checking/src/bytecode.c:919
backtrace_debug_on_exit at /home/eggert/src/gnu/emacs/static-checking/src/eval.c:159
  (inlined by) Ffuncall at 
/home/eggert/src/gnu/emacs/static-checking/src/eval.c:2791
exec_byte_code at /home/eggert/src/gnu/emacs/static-checking/src/bytecode.c:919
backtrace_debug_on_exit at /home/eggert/src/gnu/emacs/static-checking/src/eval.c:159
  (inlined by) Ffuncall at 
/home/eggert/src/gnu/emacs/static-checking/src/eval.c:2791
exec_byte_code at /home/eggert/src/gnu/emacs/static-checking/src/bytecode.c:919
backtrace_debug_on_exit at /home/eggert/src/gnu/emacs/static-checking/src/eval.c:159
  (inlined by) Ffuncall at 
/home/eggert/src/gnu/emacs/static-checking/src/eval.c:2791
exec_byte_code at /home/eggert/src/gnu/emacs/static-checking/src/bytecode.c:919
apply_lambda at /home/eggert/src/gnu/emacs/static-checking/src/eval.c:2829
eval_sub at /home/eggert/src/gnu/emacs/static-checking/src/eval.c:2256
Feval at /home/eggert/src/gnu/emacs/static-checking/src/eval.c:1997 
(discriminator 3)
internal_condition_case at 
/home/eggert/src/gnu/emacs/static-checking/src/eval.c:1350
top_level_1 at /home/eggert/src/gnu/emacs/static-checking/src/keyboard.c:1162
internal_catch at /home/eggert/src/gnu/emacs/static-checking/src/eval.c:1110
command_loop at /home/eggert/src/gnu/emacs/static-checking/src/keyboard.c:1118
recursive_edit_1 at /home/eggert/src/gnu/emacs/static-checking/src/keyboard.c:729
Frecursive_edit at /home/eggert/src/gnu/emacs/static-checking/src/keyboard.c:800