Bug 1394024 - Handle null string when alerting plugin about Windows microphone change. r=jimm
authorDavid Parks <dparks@mozilla.com>
Tue, 12 Sep 2017 14:14:14 -0700
changeset 430302 0f81c3cd701a61619e7c14ec4906f97604d4026a
parent 430301 a88de77074283143e5c9c6b7cfc7d66621034832
child 430303 3792a715a50dcd211d5a72ae3be1bf58a9de8ebf
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1394024
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1394024 - Handle null string when alerting plugin about Windows microphone change. r=jimm Fixes crash when unplugging the only available microphone.
dom/plugins/ipc/PluginUtilsWin.cpp
--- a/dom/plugins/ipc/PluginUtilsWin.cpp
+++ b/dom/plugins/ipc/PluginUtilsWin.cpp
@@ -81,17 +81,17 @@ public:
 
   // IMMNotificationClient Implementation
   HRESULT STDMETHODCALLTYPE
   OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR device_id) override
   {
     NPAudioDeviceChangeDetailsIPC changeDetails;
     changeDetails.flow = (int32_t)flow;
     changeDetails.role = (int32_t)role;
-    changeDetails.defaultDevice = std::wstring(device_id);
+    changeDetails.defaultDevice = device_id ? std::wstring(device_id) : L"";
 
     // Make sure that plugin is notified on the main thread.
     RefPtr<AudioDeviceChangedRunnable> runnable =
       new AudioDeviceChangedRunnable(&mAudioNotificationSet, changeDetails);
     NS_DispatchToMainThread(runnable);
     return S_OK;
   }