mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1232670: Prepare Bluetooth PDU for sending after checking connection status, r=shuang
The PDU contains a pointer to the operation's result handler. If sending fails, the result handler is supposed to handle an error. But the PDU will go out of scope first and release the handler. The error delivery then fails with a segmentation fault.
This commit is contained in:
parent
6c0dc2e2a4
commit
96ad167bfc
@ -145,15 +145,15 @@ BluetoothDaemonProtocol::Send(DaemonSocketPDU* aPDU,
|
||||
MOZ_ASSERT(mConnection);
|
||||
MOZ_ASSERT(aPDU);
|
||||
|
||||
aPDU->SetConsumer(this);
|
||||
aPDU->SetResultHandler(aRes);
|
||||
aPDU->UpdateHeader();
|
||||
|
||||
if (mConnection->GetConnectionStatus() == SOCKET_DISCONNECTED) {
|
||||
BT_LOGR("Connection to Bluetooth daemon is closed.");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aPDU->SetConsumer(this);
|
||||
aPDU->SetResultHandler(aRes);
|
||||
aPDU->UpdateHeader();
|
||||
|
||||
mConnection->SendSocketData(aPDU); // Forward PDU to command channel
|
||||
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user