diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2018-03-04 18:11:08 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2018-03-07 11:37:29 +0000 |
commit | 8e4964b9d268128972798ad9ae2ccbc8bbb5428f (patch) | |
tree | 2069f866f54136fab07668432b182079320d7ee5 /LICENSE.LGPL3 | |
parent | 6f62e9de520a50a7bc90241d4a5d2c385a25373f (diff) | |
download | qtserialport-8e4964b9d268128972798ad9ae2ccbc8bbb5428f.tar.gz |
Don't poll for POLLIN event if device is open in WriteOnly on Linux
Following code snippet:
QSerialPort serial("/dev/ttyUSB0");
serial.open(QIODevice::WriteOnly);
serial.write("ABCDEF");
serial.waitForBytesWritten(-1);
causes an application crash if some of data will be received by the
serial port.
Reason is that qt_poll_msecs() triggered with POLLIN event, even if the
device is opened with O_WRONLY flag. In this case the readNotification()
handler is called, which trying to reserve some space from the
uninitialized read QRingBuffer, that causes an assertion.
Solution is to don't use the POLLIN event if device is open with
O_WRONLY flag.
Change-Id: I0eb0a0c7072ce164a6c0fe518521b87383b84505
(cherry picked from commit ea1a95d3567f1264126bf34218a5532ffb5afc51)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'LICENSE.LGPL3')
0 files changed, 0 insertions, 0 deletions