[banshee/stable-2.6] MtpSource: prevent a freeze when dealing with Windows Phone (bgo#687495)
- From: Andrés Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/stable-2.6] MtpSource: prevent a freeze when dealing with Windows Phone (bgo#687495)
- Date: Wed, 22 May 2013 13:49:55 +0000 (UTC)
commit 4f69e71970a9db3b8e5930fc6af06718cabc11e4
Author: Andres G. Aragoneses <knocte gmail com>
Date: Wed May 22 14:48:22 2013 +0100
MtpSource: prevent a freeze when dealing with Windows Phone (bgo#687495)
An ArgumentNullException was raised when accessing the BytesUsed property
of MtpSource class, which can be easily avoided by checking for null first.
If mtp_device is null it means that its initialization has not succeded,
something which should be logged by the DeviceInitialize() method.
.../Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
b/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
index 766f066..a9da82d 100644
--- a/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
+++ b/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
@@ -294,7 +294,7 @@ namespace Banshee.Dap.Mtp
private long bytes_used;
public override long BytesUsed {
get {
- if (Monitor.TryEnter (mtp_device)) {
+ if (mtp_device != null && Monitor.TryEnter (mtp_device)) {
try {
bytes_used = 0;
foreach (DeviceStorage s in mtp_device.GetStorage ()) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]