[banshee] ServiceManager: check properly if a service is required (bgo#626659)
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] ServiceManager: check properly if a service is required (bgo#626659)
- Date: Mon, 21 May 2012 19:21:03 +0000 (UTC)
commit 77768e908843138977e7ae65a62cc873cf857448
Author: Andres G. Aragoneses <knocte gmail com>
Date: Sun May 20 23:50:16 2012 +0100
ServiceManager: check properly if a service is required (bgo#626659)
There was infrastructure already in Banshee to determine if certain
service initialized could be ignored or not: services which are
fundamental to properly run Banshee where just marked with the
interface IRequiredService. However the check for this was wrong,
as it tried to check the type of the service instance, rather than
the service type; then, the instance would be null if it couldn't
be initialized, and a null value apparently cannot behave as we
want when used with the 'is' operator.
The check now is done against the type of the service that needs
to be initialized, rather than the instance resultant of the
initialization.
This bug was causing fatal errors to be ignored and allowing the
resuming of Banshee launch, which in the end caused other kind
of exceptions unrelated to the root cause (i.e. NREs when the
database file is locked or gets corrupted).
Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>
.../Banshee.ServiceStack/ServiceManager.cs | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs b/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
index 374897c..5b54f69 100644
--- a/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
+++ b/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
@@ -181,7 +181,7 @@ namespace Banshee.ServiceStack
return service;
} catch (Exception e) {
- if (service is IRequiredService) {
+ if (typeof (IRequiredService).IsAssignableFrom (type)) {
Log.ErrorFormat ("Error initializing required service {0}",
service == null ? type.ToString () : service.ServiceName, false);
throw;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]