masm11 / emacs

Mirror of GNU Emacs
http://www.gnu.org/software/emacs/
GNU General Public License v3.0
198 stars 14 forks source link

GTK Error on childframes #61

Closed A6GibKm closed 3 years ago

A6GibKm commented 3 years ago

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

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 :confetti_ball: . this also means that I am not able to test how it behaves in upstream Emacs.

fejfighter commented 3 years ago

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"

A6GibKm commented 3 years ago

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)
fejfighter commented 3 years ago

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

A6GibKm commented 3 years ago

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.

fejfighter commented 3 years ago

@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

masm11 commented 3 years ago

@A6GibKm Thanks. #63 should fix this.

A6GibKm commented 3 years ago

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.

A6GibKm commented 3 years ago

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.

masm11 commented 3 years ago

thanks for the testing.