Skip to content

Bug: 2 tray icons. App crashes when you destroy 1 tray icon #14036

Closed

Description

@pjebs
  • Electron Version: latest (non beta)
  • Operating System (Platform and Version): mac high sierrra
  • Last known working Electron version: n/a

Expected Behavior
I have 2 independent tray icons. When I destroy one icon sometimes application crashes with this error:
Electron[6667:281388] -[__NSCFString isMenuOpen]: unrecognized selector sent to instance 0x7fc7f35c28d0

Actual behavior
It should not crash

Activity

  1. pjebs commented on Aug 12, 2018

    @pjebs
    Author

    It happens when you try and destroy one of them using destroy()

  2. pjebs commented on Aug 12, 2018

    @pjebs
    Author
    const {
        app,
        Menu,
        Tray,
        BrowserWindow
    } = require('electron')
    
    let tray1 = null
    let tray2 = null
    app.on('ready', () => {
        tray1 = new Tray("/Users/X/Developer/X/img/tray/trayTemplate.png")
        const contextMenu = Menu.buildFromTemplate([{
                label: 'Item1',
                type: 'radio'
            },
            {
                label: 'Item4',
                type: 'radio'
            }
        ])
    
        tray1.on('click', () => {
            tray1.popUpContextMenu(contextMenu)
        })
    
        tray2 = new Tray("/Users/X/Developer/X/img/tray/tray_win_no_internetTemplate.png")
        const contextMenu2 = Menu.buildFromTemplate([{
                label: 'Item1',
                type: 'radio'
            },
            {
                label: 'Crash',
                type: 'radio',
                checked: true,
                click() {
                    tray2.destroy() // Crashes application reliably
                }
            } 
        ])
    
        tray2.setContextMenu(contextMenu2)
    
        let win = new BrowserWindow();
        win.loadURL('https://www.youtube.com');
    })
    
  3. pjebs commented on Aug 12, 2018

    @pjebs
    Author

    Destroying the second tray crashes the application. 99% no logs. no warnings nothing. 1% of the time Electron[6667:281388] -[__NSCFString isMenuOpen]: unrecognized selector sent to instance 0x7fc7f35c28d0

  4. pjebs commented on Aug 12, 2018

    @pjebs
    Author

    @fantasticsid have you experienced this issue?

  5. changed the title [-]2 tray icons[/-] [+]Bug: 2 tray icons. App crashes when you destroy 1 tray icon[/+] on Aug 12, 2018
  6. pjebs commented on Aug 12, 2018

    @pjebs
    Author

    I feel this may be a regression because I can't remember this happening 3 months ago.

  7. pjebs commented on Aug 12, 2018

    @pjebs
    Author
  8. ckerr commented on Aug 12, 2018

    @ckerr
    Member

    By 'latest nonbeta' can you confirm you mean the literal latest nonbeta version 2.0.7, rather than the latest stable version in the 1.7 or 1.8 branches?

  9. added
    blocked/need-info ❌
    on Aug 12, 2018
  10. pjebs commented on Aug 12, 2018

    @pjebs
    Author

    By 'latest nonbeta' can you confirm you mean the literal latest nonbeta version 2.0.7, rather than the latest stable version in the 1.7 or 1.8 branches?

    2.0.7

  11. pjebs commented on Aug 12, 2018

    @pjebs
    Author

    With: ELECTRON_ENABLE_STACK_DUMPING=true

    Received signal 11 SEGV_MAPERR 07fe7fe700a0
     [0x0001018b2fdc]
     [0x0001018b2ed1]
     [0x7fff7d57af5a]
     [0x000000000000]
     [0x0001016ec5ae]
     [0x0001016ecb18]
     [0x0001016ed5ce]
     [0x7fff5293770c]
     [0x7fff529373a2]
     [0x7fff5293745e]
     [0x7fff528ffc5e]
     [0x7fff5290479d]
     [0x7fff52a1832c]
     [0x7fff531c7998]
     [0x7fff5291257a]
     [0x7fff52b91249]
     [0x7fff7c64fc6a]
     [0x7fff52b6d149]
     [0x7fff530a5053]
     [0x7fff7c64b042]
     [0x7fff530b620c]
     [0x7fff52914885]
     [0x00010188d30e]
     [0x00010188bd0c]
     [0x0001018a2183]
     [0x000101b0e60f]
     [0x000101b0e430]
     [0x000101b10ab2]
     [0x000101b0a48c]
     [0x000101a53660]
     [0x0001036538b4]
     [0x000101a52474]
     [0x0001015fbe84]
     [0x0001015f1f26]
     [0x7fff7d26c015]
    [end of stack trace]
    

    (not sure what you can learn from it)

  12. added and removed
    blocked/need-info ❌
    on Aug 13, 2018
  13. miniak commented on Sep 2, 2018

    @miniak
    Contributor

    Fixed by #14347

  14. miniak commented on Sep 2, 2018

    @miniak
    Contributor

    Will be available in 2.0.9 when it’s released
    v2.0.8...2-0-x

  15. pjebs commented on Jun 25, 2019

    @pjebs
    Author

    @miniak This issue is not fixed.

  16. maxpavlov commented on Jul 22, 2020

    @maxpavlov

    Still not fixed, if the main window is Maximized, Tray.destroy will simply throw an error.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions