Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Commit b8b277b

Browse files
committed
Merge pull request #373 from fungl164/fungl164/chrome-live-osx-2
Fix crash when closing Chrome without a callback function in place
2 parents 7ed6c3e + f0daa35 commit b8b277b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

appshell/appshell_extensions_mac.mm

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,23 @@ void SetLiveBrowserPid(int pid)
151151

152152
void LiveBrowserMgrMac::CloseLiveBrowserFireCallback(int valToSend)
153153
{
154-
CefRefPtr<CefListValue> responseArgs = m_closeLiveBrowserCallback->GetArgumentList();
155-
156154
// kill the timers
157155
CloseLiveBrowserKillTimers();
158156

159157
// Stop listening for ws shutdown notifications
160158
RemoveWorkspaceNotifications();
161159

162-
// Set common response args (callbackId and error)
163-
responseArgs->SetInt(1, valToSend);
164-
165-
// Send response
166-
m_browser->SendProcessMessage(PID_RENDERER, m_closeLiveBrowserCallback);
160+
// Prepare response
161+
if (m_closeLiveBrowserCallback) {
162+
163+
CefRefPtr<CefListValue> responseArgs = m_closeLiveBrowserCallback->GetArgumentList();
164+
165+
// Set common response args (callbackId and error)
166+
responseArgs->SetInt(1, valToSend);
167+
168+
// Send response
169+
m_browser->SendProcessMessage(PID_RENDERER, m_closeLiveBrowserCallback);
170+
}
167171

168172
// Clear state
169173
m_closeLiveBrowserCallback = NULL;

0 commit comments

Comments
 (0)