peripherals: call OnDeviceRemoved() before destructing a device when the device was...
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 23 Apr 2012 12:03:46 +0000 (14:03 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 2 Jul 2012 08:49:47 +0000 (10:49 +0200)
xbmc/peripherals/bus/PeripheralBus.cpp
xbmc/peripherals/devices/Peripheral.h

index 5b4081d..0f609da 100644 (file)
@@ -143,7 +143,10 @@ void CPeripheralBus::UnregisterRemovedDevices(const PeripheralScanResults &resul
     {
       /* device removed */
       if (peripheral->Type() != PERIPHERAL_UNKNOWN)
+      {
         CLog::Log(LOGNOTICE, "%s - device removed from %s/%s: %s (%s:%s)", __FUNCTION__, PeripheralTypeTranslator::TypeToString(peripheral->Type()), peripheral->Location().c_str(), peripheral->DeviceName().c_str(), peripheral->VendorIdAsString(), peripheral->ProductIdAsString());
+        peripheral->OnDeviceRemoved();
+      }
       m_peripherals.erase(m_peripherals.begin() + iDevicePtr);
       lock.Leave();
 
index 31ac1f7..1b699f2 100644 (file)
@@ -88,6 +88,11 @@ namespace PERIPHERALS
     virtual void OnSettingChanged(const CStdString &strChangedSetting) {};
 
     /*!
+     * @brief Called when this device is removed, before calling the destructor.
+     */
+    virtual void OnDeviceRemoved(void) {}
+
+    /*!
      * @brief Get all subdevices if this device is multifunctional.
      * @param subDevices The subdevices.
      */