lxde / lxterminal

VTE terminal emulator written in GTK
GNU General Public License v2.0
159 stars 56 forks source link

With VTE 0.54, hitting X button of one tab closes all tabs #61

Closed yan12125 closed 5 years ago

yan12125 commented 6 years ago

Original bug report: https://bugs.archlinux.org/task/60035

gdb indicates that running gtk_notebook_remove_page(GTK_NOTEBOOK(terminal->notebook), term->index) for the closing tab triggers another child-exited signal, thus causing the next tab to be closed. This procedure is going through recursively and then all tabs are closed.

The relevant change in VTE might be this: https://gitlab.gnome.org/GNOME/vte/commit/0276859709692ec53f35a8cc158d7553a195c730

egmontkob commented 5 years ago

Inside terminal_close_button_event(), replacing terminal_child_exited_event(vte, 0, term); by gtk_widget_destroy(term->vte); seems to work for me at first glimpse. I'm not sure if this is the proper solution.

(Perhaps should be conditional to vte-0.54, leaving the old code path for older vte versions, I haven't tested that.)

Note though that terminal_close_button_event()'s signature is confusingly broken. The first argument it receives and forwards to terminal_child_exited_event() is a GtkButton (the close button) and not a VteTerminal. Looks like a more thorough check of the code around these bits is desirable.

egmontkob commented 5 years ago

Probably a fix along the lines of https://bugs.launchpad.net/sakura/+bug/1790317 would be better, that is, to explicitly disconnect the child-exited signal before removing vte from the widget hierarchy.

(I'd let you guys play with it, I'm not planning to further work on this issue.)

medicalwei commented 5 years ago

Note though that terminal_close_button_event()'s signature is confusingly broken. The first argument it receives and forwards to terminal_child_exited_event() is a GtkButton (the close button) and not a VteTerminal. Looks like a more thorough check of the code around these bits is desirable.

This is addressed in a4eaef4 as well.

However, for this issue please test and reopen if disconnecting the signal on child-exited doesn't help.

yan12125 commented 5 years ago

Anything wrong with https://github.com/lxde/lxterminal/commit/a4eaef43ab3afaea12db70318df7d2db5aad39db? That works fine for me.

medicalwei commented 5 years ago

My mistake. I was running on wrong binary to test it and found out the bug "persists".