hrev50290 adds 8 changesets to branch 'master'
old head: 9c59cb0692074631f29438473b2a86d0f0472de2
new head: e20d72d94730b9ecd0ab32c8c7044f14add8d72e
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=e20d72d94730+%5E9c59cb069207
----------------------------------------------------------------------------
73f5ab0cf677: bluetooth_server: Don't show an error when the Prefs app couldn't
start.
The only error I can think of (and the one that this displays) is that
the preflet is already running, which is not very helpful.
b984932928e2: bluetooth_server: Make the replicant remove itself if the server
isn't running.
ebb0fb0364f0: bluetooth_server: Don't dereference before NULL check.
Fixes a crash when there are no local devices.
f52a021a330e: preferences/bluetooth: Add some missing NULL checks.
Fixes some more crashes when nothing is selected.
f7359bb49a72: preferences/bluetooth: Make the "show debug" menu item actually
work.
0cce7d31c568: bluetooth_server: Remove the "show debug console" item from the
replicant.
Redundant (the Preferences dialog now has this), and unnecessary, as only
developers want it; it'll confuse end-users.
aa0020bf0746: preferences/bluetooth: Remove last non-layout code.
e20d72d94730: preferences/bluetooth: Remove a bunch of needless debug
statements.
[ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]
----------------------------------------------------------------------------
8 files changed, 42 insertions(+), 73 deletions(-)
.../bluetooth/BluetoothSettingsView.cpp | 2 +-
src/preferences/bluetooth/BluetoothWindow.cpp | 13 ++++--
.../bluetooth/ExtendedLocalDeviceView.cpp | 20 +++------
.../bluetooth/ExtendedLocalDeviceView.h | 5 +--
src/preferences/bluetooth/RemoteDevicesView.cpp | 16 +++++--
src/servers/bluetooth/BluetoothServer.cpp | 8 ++--
src/servers/bluetooth/DeskbarReplicant.cpp | 45 +++-----------------
src/servers/bluetooth/DeskbarReplicant.h | 6 +--
############################################################################
Commit: 73f5ab0cf6772eda68558120ad4b053146bb01d6
URL: http://cgit.haiku-os.org/haiku/commit/?id=73f5ab0cf677
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 6 16:42:53 2016 UTC
bluetooth_server: Don't show an error when the Prefs app couldn't start.
The only error I can think of (and the one that this displays) is that
the preflet is already running, which is not very helpful.
----------------------------------------------------------------------------
diff --git a/src/servers/bluetooth/DeskbarReplicant.cpp
b/src/servers/bluetooth/DeskbarReplicant.cpp
index 7d164d7..adb666c 100644
--- a/src/servers/bluetooth/DeskbarReplicant.cpp
+++ b/src/servers/bluetooth/DeskbarReplicant.cpp
@@ -149,7 +149,7 @@ DeskbarReplicant::MessageReceived(BMessage* msg)
break;
case kMsgOpenBluetoothPreferences:
- _OpenBluetoothPreferences();
+ be_roster->Launch(BLUETOOTH_APP_SIGNATURE);
break;
case kMsgQuitBluetoothServer:
@@ -197,16 +197,6 @@ DeskbarReplicant::MouseDown(BPoint where)
void
-DeskbarReplicant::_OpenBluetoothPreferences()
-{
- status_t status = be_roster->Launch(BLUETOOTH_APP_SIGNATURE);
- if (status < B_OK) {
- _ShowErrorAlert("Launching the Bluetooth preflet failed.",
status);
- }
-}
-
-
-void
DeskbarReplicant::_ShowBluetoothServerConsole()
{
if (!be_roster->IsRunning(BLUETOOTH_SIGNATURE)) {
diff --git a/src/servers/bluetooth/DeskbarReplicant.h
b/src/servers/bluetooth/DeskbarReplicant.h
index ed17884..21d546a 100644
--- a/src/servers/bluetooth/DeskbarReplicant.h
+++ b/src/servers/bluetooth/DeskbarReplicant.h
@@ -33,11 +33,10 @@ class DeskbarReplicant : public BView {
private:
void _Init();
- void _OpenBluetoothPreferences();
-
+
void _ShowBluetoothServerConsole();
void _QuitBluetoothServer();
-
+
void _ShowErrorAlert(BString msg, status_t
status);
BBitmap* fIcon;
############################################################################
Commit: b984932928e28d1b0026319b7555d078cfa00fc2
URL: http://cgit.haiku-os.org/haiku/commit/?id=b984932928e2
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 6 16:49:50 2016 UTC
bluetooth_server: Make the replicant remove itself if the server isn't running.
----------------------------------------------------------------------------
diff --git a/src/servers/bluetooth/DeskbarReplicant.cpp
b/src/servers/bluetooth/DeskbarReplicant.cpp
index adb666c..102e4ca 100644
--- a/src/servers/bluetooth/DeskbarReplicant.cpp
+++ b/src/servers/bluetooth/DeskbarReplicant.cpp
@@ -214,6 +214,10 @@ void
DeskbarReplicant::_QuitBluetoothServer()
{
if (!be_roster->IsRunning(BLUETOOTH_SIGNATURE)) {
+ // The server isn't running, so remove ourself
+ BDeskbar deskbar;
+ deskbar.RemoveItem(kDeskbarItemName);
+
return;
}
status_t status = BMessenger(BLUETOOTH_SIGNATURE).SendMessage(
############################################################################
Commit: ebb0fb0364f0641cceba85f122d314265bd4cd71
URL: http://cgit.haiku-os.org/haiku/commit/?id=ebb0fb0364f0
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 6 16:54:08 2016 UTC
bluetooth_server: Don't dereference before NULL check.
Fixes a crash when there are no local devices.
----------------------------------------------------------------------------
diff --git a/src/servers/bluetooth/BluetoothServer.cpp
b/src/servers/bluetooth/BluetoothServer.cpp
index 534574f..1abf460 100644
--- a/src/servers/bluetooth/BluetoothServer.cpp
+++ b/src/servers/bluetooth/BluetoothServer.cpp
@@ -343,9 +343,9 @@ BluetoothServer::HandleAcquireLocalDevice(BMessage*
message, BMessage* reply)
for (int index = lastIndex + 1;
index < fLocalDevicesList.CountItems(); index++) {
lDeviceImpl= fLocalDevicesList.ItemAt(index);
- printf("Requesting local device %" B_PRId32 "\n",
- lDeviceImpl->GetID());
if (lDeviceImpl != NULL && lDeviceImpl->Available()) {
+ printf("Requested local device %" B_PRId32 "\n",
+ lDeviceImpl->GetID());
Output::Instance()->Postf(BLACKBOARD_KIT,
"Device available: %lx\n",
lDeviceImpl->GetID());
lastIndex = index;
@@ -357,9 +357,9 @@ BluetoothServer::HandleAcquireLocalDevice(BMessage*
message, BMessage* reply)
if (lDeviceImpl == NULL) {
for (int index = 0; index <= lastIndex ; index ++) {
lDeviceImpl = fLocalDevicesList.ItemAt(index);
- printf("Requesting local device %" B_PRId32
"\n",
- lDeviceImpl->GetID());
if (lDeviceImpl != NULL &&
lDeviceImpl->Available()) {
+ printf("Requested local device %"
B_PRId32 "\n",
+ lDeviceImpl->GetID());
Output::Instance()->Postf(BLACKBOARD_KIT,
"Device available: %lx\n",
lDeviceImpl->GetID());
lastIndex = index;
############################################################################
Commit: f52a021a330e796a7b1caeaafc7301baee86713b
URL: http://cgit.haiku-os.org/haiku/commit/?id=f52a021a330e
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 6 17:03:08 2016 UTC
preferences/bluetooth: Add some missing NULL checks.
Fixes some more crashes when nothing is selected.
----------------------------------------------------------------------------
diff --git a/src/preferences/bluetooth/RemoteDevicesView.cpp
b/src/preferences/bluetooth/RemoteDevicesView.cpp
index 6c7904b..15545a9 100644
--- a/src/preferences/bluetooth/RemoteDevicesView.cpp
+++ b/src/preferences/bluetooth/RemoteDevicesView.cpp
@@ -139,10 +139,14 @@ RemoteDevicesView::MessageReceived(BMessage* message)
{
DeviceListItem* device =
static_cast<DeviceListItem*>(fDeviceList
->ItemAt(fDeviceList->CurrentSelection(0)));
+ if (device == NULL)
+ break;
+
RemoteDevice* remote =
dynamic_cast<RemoteDevice*>(device->Device());
+ if (remote == NULL)
+ break;
- if (remote != NULL)
- remote->Authenticate();
+ remote->Authenticate();
break;
}
@@ -150,10 +154,14 @@ RemoteDevicesView::MessageReceived(BMessage* message)
{
DeviceListItem* device =
static_cast<DeviceListItem*>(fDeviceList
->ItemAt(fDeviceList->CurrentSelection(0)));
+ if (device == NULL)
+ break;
+
RemoteDevice* remote =
dynamic_cast<RemoteDevice*>(device->Device());
+ if (remote == NULL)
+ break;
- if (remote != NULL)
- remote->Disconnect();
+ remote->Disconnect();
break;
}
############################################################################
Commit: f7359bb49a7269c1788bd224688390f61a88f682
URL: http://cgit.haiku-os.org/haiku/commit/?id=f7359bb49a72
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 6 17:09:16 2016 UTC
preferences/bluetooth: Make the "show debug" menu item actually work.
----------------------------------------------------------------------------
diff --git a/src/preferences/bluetooth/BluetoothWindow.cpp
b/src/preferences/bluetooth/BluetoothWindow.cpp
index 6467808..e910385 100644
--- a/src/preferences/bluetooth/BluetoothWindow.cpp
+++ b/src/preferences/bluetooth/BluetoothWindow.cpp
@@ -60,7 +60,7 @@ BluetoothWindow::BluetoothWindow(BRect frame)
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(
B_TRANSLATE("Show bluetooth console" B_UTF8_ELLIPSIS),
- new BMessage(kMsgStartServices), 0));
+ new BMessage(kMsgShowDebug), 0));
menu->AddItem(new BMenuItem(
B_TRANSLATE("Refresh LocalDevices" B_UTF8_ELLIPSIS),
new BMessage(kMsgRefresh), 0));
@@ -121,6 +121,7 @@ BluetoothWindow::MessageReceived(BMessage* message)
||
fAntialiasingSettings->IsDefaultable());
fRevertButton->SetEnabled(false);
*/ break;
+
case kMsgStartServices:
printf("kMsgStartServices\n");
if (!be_roster->IsRunning(BLUETOOTH_SIGNATURE)) {
@@ -128,7 +129,6 @@ BluetoothWindow::MessageReceived(BMessage* message)
printf("kMsgStartServices: %s\n",
strerror(error));
}
break;
-
case kMsgStopServices:
printf("kMsgStopServices\n");
if (be_roster->IsRunning(BLUETOOTH_SIGNATURE)) {
@@ -136,6 +136,13 @@ BluetoothWindow::MessageReceived(BMessage* message)
printf("kMsgStopServices: %s\n",
strerror(error));
}
break;
+ case kMsgShowDebug:
+ if (be_roster->IsRunning(BLUETOOTH_SIGNATURE)) {
+ status_t error =
BMessenger(BLUETOOTH_SIGNATURE).SendMessage(
+ BT_MSG_SERVER_SHOW_CONSOLE);
+ printf("kMsgShowDebug: %s\n", strerror(error));
+ }
+ break;
case kMsgAddToRemoteList:
PostMessage(message, fRemoteDevices);
############################################################################
Commit: 0cce7d31c568aa8dee1c8210ed9b84c4040cc2b3
URL: http://cgit.haiku-os.org/haiku/commit/?id=0cce7d31c568
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 6 17:12:07 2016 UTC
bluetooth_server: Remove the "show debug console" item from the replicant.
Redundant (the Preferences dialog now has this), and unnecessary, as only
developers want it; it'll confuse end-users.
----------------------------------------------------------------------------
diff --git a/src/servers/bluetooth/DeskbarReplicant.cpp
b/src/servers/bluetooth/DeskbarReplicant.cpp
index 102e4ca..226cd4f 100644
--- a/src/servers/bluetooth/DeskbarReplicant.cpp
+++ b/src/servers/bluetooth/DeskbarReplicant.cpp
@@ -26,7 +26,6 @@
extern "C" _EXPORT BView *instantiate_deskbar_item(void);
status_t our_image(image_info& image);
-const uint32 kMsgShowBluetoothServerConsole = 'sbtc';
const uint32 kMsgOpenBluetoothPreferences = 'obtp';
const uint32 kMsgQuitBluetoothServer = 'qbts';
@@ -144,10 +143,6 @@ void
DeskbarReplicant::MessageReceived(BMessage* msg)
{
switch (msg->what) {
- case kMsgShowBluetoothServerConsole:
- _ShowBluetoothServerConsole();
- break;
-
case kMsgOpenBluetoothPreferences:
be_roster->Launch(BLUETOOTH_APP_SIGNATURE);
break;
@@ -179,15 +174,7 @@ DeskbarReplicant::MouseDown(BPoint where)
// TODO show list of known/paired devices
- /* The code below is for development purposes only, but doesn't
- * hurt to be enabled as long as in alpha state.
- */
- menu->AddSeparatorItem();
-
- menu->AddItem(new BMenuItem("Show server console" B_UTF8_ELLIPSIS,
- new BMessage(kMsgShowBluetoothServerConsole)));
-
- menu->AddItem(new BMenuItem("Stop server",
+ menu->AddItem(new BMenuItem("Quit",
new BMessage(kMsgQuitBluetoothServer)));
menu->SetTargetForItems(this);
@@ -197,20 +184,6 @@ DeskbarReplicant::MouseDown(BPoint where)
void
-DeskbarReplicant::_ShowBluetoothServerConsole()
-{
- if (!be_roster->IsRunning(BLUETOOTH_SIGNATURE)) {
- return;
- }
- status_t status = BMessenger(BLUETOOTH_SIGNATURE).SendMessage(
- BT_MSG_SERVER_SHOW_CONSOLE);
- if (status < B_OK) {
- _ShowErrorAlert("Showing the Bluetooth server console failed.",
status);
- }
-}
-
-
-void
DeskbarReplicant::_QuitBluetoothServer()
{
if (!be_roster->IsRunning(BLUETOOTH_SIGNATURE)) {
diff --git a/src/servers/bluetooth/DeskbarReplicant.h
b/src/servers/bluetooth/DeskbarReplicant.h
index 21d546a..d64a3e4 100644
--- a/src/servers/bluetooth/DeskbarReplicant.h
+++ b/src/servers/bluetooth/DeskbarReplicant.h
@@ -34,7 +34,6 @@ class DeskbarReplicant : public BView {
private:
void _Init();
- void _ShowBluetoothServerConsole();
void _QuitBluetoothServer();
void _ShowErrorAlert(BString msg, status_t
status);
############################################################################
Commit: aa0020bf0746210dd6b2a78ccef4558a8d7cde11
URL: http://cgit.haiku-os.org/haiku/commit/?id=aa0020bf0746
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 6 17:17:59 2016 UTC
preferences/bluetooth: Remove last non-layout code.
----------------------------------------------------------------------------
diff --git a/src/preferences/bluetooth/BluetoothSettingsView.cpp
b/src/preferences/bluetooth/BluetoothSettingsView.cpp
index 28355d7..cfb9e10 100644
--- a/src/preferences/bluetooth/BluetoothSettingsView.cpp
+++ b/src/preferences/bluetooth/BluetoothSettingsView.cpp
@@ -69,7 +69,7 @@ BluetoothSettingsView::BluetoothSettingsView(const char* name)
fInquiryTimeControl->SetHashMarkCount(255 / 15);
fInquiryTimeControl->SetEnabled(true);
- fExtDeviceView = new ExtendedLocalDeviceView(BRect(0, 0, 5, 5), NULL);
+ fExtDeviceView = new ExtendedLocalDeviceView(NULL);
// localdevices menu
_BuildLocalDevicesMenu();
diff --git a/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp
b/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp
index 795aa93..2ae2258 100644
--- a/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp
+++ b/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp
@@ -19,10 +19,10 @@
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Extended local device view"
-ExtendedLocalDeviceView::ExtendedLocalDeviceView(BRect frame,
- LocalDevice* bDevice, uint32 resizingMode, uint32 flags)
+ExtendedLocalDeviceView::ExtendedLocalDeviceView(LocalDevice* bDevice,
+ uint32 flags)
:
- BView(frame,"ExtendedLocalDeviceView", resizingMode, flags |
B_WILL_DRAW),
+ BView("ExtendedLocalDeviceView", flags | B_WILL_DRAW),
fDevice(bDevice),
fScanMode(0)
{
@@ -51,9 +51,8 @@ ExtendedLocalDeviceView::ExtendedLocalDeviceView(BRect frame,
}
-ExtendedLocalDeviceView::~ExtendedLocalDeviceView(void)
+ExtendedLocalDeviceView::~ExtendedLocalDeviceView()
{
-
}
diff --git a/src/preferences/bluetooth/ExtendedLocalDeviceView.h
b/src/preferences/bluetooth/ExtendedLocalDeviceView.h
index 3a3526c..31a8077 100644
--- a/src/preferences/bluetooth/ExtendedLocalDeviceView.h
+++ b/src/preferences/bluetooth/ExtendedLocalDeviceView.h
@@ -22,10 +22,9 @@ class BCheckBox;
class ExtendedLocalDeviceView : public BView
{
public:
- ExtendedLocalDeviceView(BRect frame, LocalDevice* bDevice,
- uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
+ ExtendedLocalDeviceView(LocalDevice* bDevice,
uint32 flags = B_WILL_DRAW);
- ~ExtendedLocalDeviceView(void);
+ ~ExtendedLocalDeviceView();
void SetLocalDevice(LocalDevice* lDevice);
############################################################################
Revision: hrev50290
Commit: e20d72d94730b9ecd0ab32c8c7044f14add8d72e
URL: http://cgit.haiku-os.org/haiku/commit/?id=e20d72d94730
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 6 17:20:54 2016 UTC
preferences/bluetooth: Remove a bunch of needless debug statements.
----------------------------------------------------------------------------
diff --git a/src/preferences/bluetooth/BluetoothWindow.cpp
b/src/preferences/bluetooth/BluetoothWindow.cpp
index e910385..9c186db 100644
--- a/src/preferences/bluetooth/BluetoothWindow.cpp
+++ b/src/preferences/bluetooth/BluetoothWindow.cpp
@@ -123,14 +123,12 @@ BluetoothWindow::MessageReceived(BMessage* message)
*/ break;
case kMsgStartServices:
- printf("kMsgStartServices\n");
if (!be_roster->IsRunning(BLUETOOTH_SIGNATURE)) {
status_t error =
be_roster->Launch(BLUETOOTH_SIGNATURE);
printf("kMsgStartServices: %s\n",
strerror(error));
}
break;
case kMsgStopServices:
- printf("kMsgStopServices\n");
if (be_roster->IsRunning(BLUETOOTH_SIGNATURE)) {
status_t error =
BMessenger(BLUETOOTH_SIGNATURE).SendMessage(B_QUIT_REQUESTED);
printf("kMsgStopServices: %s\n",
strerror(error));
diff --git a/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp
b/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp
index 2ae2258..9cfad3c 100644
--- a/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp
+++ b/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp
@@ -59,7 +59,6 @@ ExtendedLocalDeviceView::~ExtendedLocalDeviceView()
void
ExtendedLocalDeviceView::SetLocalDevice(LocalDevice* lDevice)
{
- printf("ExtendedLocalDeviceView::SetLocalDevice\n");
if (lDevice != NULL) {
fDevice = lDevice;
SetName(lDevice->GetFriendlyName().String());
@@ -84,7 +83,6 @@ ExtendedLocalDeviceView::SetLocalDevice(LocalDevice* lDevice)
void
ExtendedLocalDeviceView::AttachedToWindow()
{
- printf("ExtendedLocalDeviceView::AttachedToWindow\n");
fDiscoverable->SetTarget(this);
fVisible->SetTarget(this);
fAuthentication->SetTarget(this);
@@ -101,10 +99,9 @@ ExtendedLocalDeviceView::SetTarget(BHandler* target)
void
ExtendedLocalDeviceView::MessageReceived(BMessage* message)
{
- printf("ExtendedLocalDeviceView::MessageReceived\n");
-
if (fDevice == NULL) {
printf("ExtendedLocalDeviceView::Device missing\n");
+ BView::MessageReceived(message);
return;
}
@@ -140,7 +137,7 @@ ExtendedLocalDeviceView::MessageReceived(BMessage* message)
default:
BView::MessageReceived(message);
- break;
+ break;
}
}
@@ -148,8 +145,6 @@ ExtendedLocalDeviceView::MessageReceived(BMessage* message)
void
ExtendedLocalDeviceView::SetEnabled(bool value)
{
- printf("ExtendedLocalDeviceView::SetEnabled\n");
-
fVisible->SetEnabled(value);
fAuthentication->SetEnabled(value);
fDiscoverable->SetEnabled(value);
@@ -159,8 +154,6 @@ ExtendedLocalDeviceView::SetEnabled(bool value)
void
ExtendedLocalDeviceView::ClearDevice()
{
- printf("ExtendedLocalDeviceView::ClearDevice\n");
-
fVisible->SetValue(false);
fAuthentication->SetValue(false);
fDiscoverable->SetValue(false);