Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Fix phantom tab crashes #11185

Merged
merged 1 commit into from
Sep 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/renderer/components/tabs/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,15 @@ class Tab extends React.Component {
}

onDragStart (e) {
dnd.onDragStart(dragTypes.TAB, this.frame, e)
if (this.frame) {
dnd.onDragStart(dragTypes.TAB, this.frame, e)
}
}

onDragEnd (e) {
dnd.onDragEnd(dragTypes.TAB, this.frame, e)
if (this.frame) {
dnd.onDragEnd(dragTypes.TAB, this.frame, e)
}
}

onDragOver (e) {
Expand Down
11 changes: 9 additions & 2 deletions js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ function autofillTemplateInit (suggestions, frame) {
}

function tabTemplateInit (frameProps) {
if (!frameProps) {
return null
}

const frameKey = frameProps.get('key')
const tabId = frameProps.get('tabId')
const template = [CommonMenu.newTabMenuItem(frameProps.get('tabId'))]
Expand Down Expand Up @@ -1211,8 +1215,11 @@ function onMainContextMenu (nodeProps, frame, tab, contextMenuType) {

function onTabContextMenu (frameProps, e) {
e.stopPropagation()
const tabMenu = Menu.buildFromTemplate(tabTemplateInit(frameProps))
tabMenu.popup(getCurrentWindow())
const template = tabTemplateInit(frameProps)
if (template) {
const tabMenu = Menu.buildFromTemplate(template)
tabMenu.popup(getCurrentWindow())
}
}

function onNewTabContextMenu (target) {
Expand Down