Reviewing merge request #43: Fix crashes in QBluetoothLocalDevice() class members

The pointer to an instance QBluetoothLocalDevicePrivate class,
namely d_ptr, is being used not only to store location of the
platform-specific Bluetooth device object, but also to verify
validity of the QBluetoothLocalDevice at runtime.

Current implementation does not initialize the d_ptr member at
all, which means that if the constructor returns with an error,
many methods such as ::name() will segfault when dereferencing
an invalid memory location.

The simple way to reproduce the bug described above would be to
run the `btchat' example on a Linux box with no Bluetooth.

This patch adds d_ptr initialization by NULL, thus making that
pointer indicate an invalid Bluetooth device up until the point
when QBluetoothLocalDevicePrivate gets constructed.

Commits that would be merged:

Version 1
  • Version 1
  • 20d9737
  • 3b3690e
  • Fix crashes in QBluetoothLocalDevice() class members

Showing 20d9737-3b3690e

Comments

Pushed new version 1

Add a new comment:

Login or create an account to post a comment

How to apply this merge request to your repository