GTK Error on childframes
Closed this issue ยท 9 comments
When running the following snippet
(display-buffer-in-child-frame (elt (buffer-list) 1)
'((child-frame-parameters . (
(left . 0.7)
(top . 0.7)
(width . 0.3)
(height . 0.5)
))))
On an Emacs instance launched from the terminal I get the following error
(emacs:95118): Gtk-CRITICAL **: 23:26:37.707: gtk_widget_get_allocation: assertion 'GTK_IS_WIDGET (widget)' failed
As far as I am concerned the script runs just fine, but something in the pgtk implementation of childframes is making that error.
Enviroment
Fedora Silverblue 33
GNOME 3.38
Wayland
How to reproduce
- Launch emacs from the terminal
$ emacs
Open two buffers (I am not sure if this is needed)This is not needed- In one run the snippet mentioned above
Note: Due to a toolbox bug on Fedora 33 I am unable to test non pgtk builds of emacs. Without this fork it would be impossible to use emacs inside a toolbox container ๐ . this also means that I am not able to test how it behaves in upstream Emacs.
step 2 not required,
confirmed,
#1 0x00000000005bf3d1 in frame_geometry (frame=, attribute=XIL(0xa890)) at pgtkfns.c:3327
3327 gtk_widget_get_allocation (FRAME_GTK_WIDGET (f), &alloc);
frame widget is null for that frame, which makes sense, it's a child "window"
In fact, I tried reproducing this with emacs -Q
and this time it crashes
(emacs:113918): Gtk-CRITICAL **: 23:52:04.793: gtk_widget_get_allocation: assertion 'GTK_IS_WIDGET (widget)' failed
(emacs:113918): GLib-GObject-CRITICAL **: 23:52:04.820: g_object_get_data: assertion 'G_IS_OBJECT (object)' failed
(emacs:113918): GLib-GObject-CRITICAL **: 23:52:04.820: g_object_set_data: assertion 'G_IS_OBJECT (object)' failed
(emacs:113918): GLib-GObject-CRITICAL **: 23:52:04.820: g_object_get_data: assertion 'G_IS_OBJECT (object)' failed
Fatal error 11: Segmentation fault
Backtrace:
emacs[0x5012ed]
emacs[0x420178]
emacs[0x420a51]
emacs[0x622dbd]
/lib64/libpthread.so.0(+0x141e0)[0x7f35f65691e0]
emacs[0x4e3850]
emacs[0x46702e]
emacs[0x45978b]
emacs[0x56b574]
emacs[0x459705]
emacs[0x45d015]
emacs[0x4ec1da]
emacs[0x4fab58]
emacs[0x4ef76e]
emacs[0x56b4e7]
emacs[0x4e9aa4]
emacs[0x56b441]
emacs[0x4eae9b]
emacs[0x6355ab]
emacs[0x4ef4b3]
emacs[0x4298fa]
/lib64/libc.so.6(__libc_start_main+0xf2)[0x7f35f47851a2]
emacs[0x42bd5e]
Segmentation fault (core dumped)
Actually I think the widget hasn;t been created as yet, I got my macros mixed up
It's crashing with -Q as it;s trying to add the widget to a non frame that has not widgets allocated.
I have a suspicion we are creating 2 frames on startup and only one of those has widgets allocated
I just tested on the org.gnu.emacs flatpak (I can't think of another way of running a non pgtk emacs right now on my system) and running the snippet above does not cause any kind of crash nor error message.
@A6GibKm, Yes this appears to be specific to PGTK, and how frames are created. I don't expect this to affect gtk builds of upstream as the error appears to be in pgtkterm or pgtkfns
There is progress on #63,
(emacs:113918): Gtk-CRITICAL **: 23:52:04.793: gtk_widget_get_allocation: assertion 'GTK_IS_WIDGET (widget)' failed
no longer appears. But the core segmentation (emacs crashes) still happens when running as emacs -Q
. For some reason it does not happen on my regular (Doom Emacs) setup.
Tested the newer commit, not only it fixes the crash. It also behaves as expected. Thanks, I will close the issue after it is merged.
thanks for the testing.