Skip to content

Crash after unzooming a single terminal inside a tab #835

Closed

Description

@Vulcalien

To Reproduce
Open Terminator. Open a tab. Zoom the single terminal in it (Ctrl+Shift+X), then unzoom it.

Desktop: (pretty sure it's not relevant)

  • OS or Linux Distribution: Linux Mint
  • Version: 21
  • Display Technology: X11

Describe the bug
Terminator crashes when unzooming a single terminal inside a tab. When there are 2 or more terminals, the issue doesn't occur. I did a git bisect, and found that the commit introducing the bug is 11639159, pushed for PR #810. The problems seems to be here:

#notify plugins of tab-change
dbg("emit tab-change for tabpos: %s " % tabpos)
term_widget.emit('tab-change', tabpos)
self.set_current_page(tabpos)
widget.grab_focus()

in Notebook.newtab. The problem disappears when term_widget.emit('tab-change', tabpos) is removed.

When it doesn't crash, I see an extremely large number of new tabs, all containing the same terminal. Maybe it gets confused by the fact there is only one terminal..?

Activity

  1. vssdeo commented on Oct 17, 2023

    @vssdeo
    Contributor

    Let me also look into this, this PR seems to be mine. I have figured out the reason for the the trigger, where zoomed terminal calls def tab_change(self, widget, num=None, ignore = None): to unzoom which in turn creates a newtab everytime in a loop. I wanted to reused tab-change event and not add another one. I have two solutions in mind let me get a patch for this.

    Terminator::find_terminal_by_uuid: checking: urn:uuid:9c5467f0-a14b-406b-9c11-c814058f4451 (<terminal.Terminal object at 0x7fc5de3c5f00 (terminatorlib+terminal+Terminal at 0x2dc3db0)>) (/home/user/dev/terminator/terminatorlib/terminator.py:187)
    Traceback (most recent call last):
      File "/home/user/dev/terminator/terminatorlib/notebook.py", line 519, in do_deferred_on_tab_switch
        self.on_tab_switch(*self.pending_on_tab_switch_args)
      File "/home/user/dev/terminator/terminatorlib/notebook.py", line 527, in on_tab_switch
        term = self.terminator.find_terminal_by_uuid(tabs_last_active_term.urn)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/dev/terminator/terminatorlib/terminator.py", line 189, in find_terminal_by_uuid
        if terminal.get_toplevel().is_child_notebook():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'Notebook' object has no attribute 'is_child_notebook'
    
    

    Then on restore (unzoom) it goes into repeat spiral.

    Notebook::newtab: creating TabLabel with text: user@kali: ~/dev/terminator (/home/user/dev/terminator/terminatorlib/notebook.py:316)
    Notebook::newtab: inserting page at position: 1 (/home/user/dev/terminator/terminatorlib/notebook.py:323)
    
    (terminator:20321): Gtk-WARNING **: 00:47:59.080: Can't set a parent on widget which has a parent
    ConfigBase::get_item: detachable_tabs found in globals: True (/home/user/dev/terminator/terminatorlib/config.py:790)
    Terminator::find_terminal_by_uuid: searching self.terminals for: urn:uuid:ac750de6-4d46-43f9-bc35-5999788a85e0 (/home/user/dev/terminator/terminatorlib/terminator.py:185)
    Terminator::find_terminal_by_uuid: checking: urn:uuid:9c5467f0-a14b-406b-9c11-c814058f4451 (<terminal.Terminal object at 0x7fc5de3c5f00 (terminatorlib+terminal+Terminal at 0x2dc3db0)>) (/home/user/dev/terminator/terminatorlib/terminator.py:187)
    
    
    
  2. vssdeo commented on Oct 24, 2023

    @vssdeo
    Contributor

    Removed the tab-change emit code. New pull request has a decoupled plugin code using focus-in event.

  3. added a commit that references this issue on Feb 16, 2024
  4. Vulcalien commented on Feb 18, 2024

    @Vulcalien
    MemberAuthor

    I can gladly state that it's fixed now!

  5. vssdeo commented on Feb 19, 2024

    @vssdeo
    Contributor

    I can gladly state that it's fixed now!

    @Vulcalien thanks for finding this bug on time, else It would have been difficult. In addition thanks to you I was able to implement the code in a simpler way.

  6. Vulcalien commented on Feb 19, 2024

    @Vulcalien
    MemberAuthor

    I was able to implement the code in a simpler way

    That's great, glad to be helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions