Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions OpenCDMi/OCDM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ namespace Plugin {
ForceLinkingOfOpenCDM();
#endif

std::lock_guard<std::recursive_mutex> lock {_serviceInitMutex};
string message;

ASSERT(service != nullptr);
Expand Down Expand Up @@ -157,8 +158,13 @@ namespace Plugin {

/*virtual*/ void OCDM::Deinitialize(PluginHost::IShell* service)
{
std::lock_guard<std::recursive_mutex> lock {_serviceInitMutex};
ASSERT(_service == service);

if (_service == nullptr) {
TRACE(Trace::Error, (_T("OCDM::Deinitialize called with null _service; will be skipped. %d"), __LINE__));
return;
}
_service->Unregister(&_notification);

if(_opencdmi != nullptr) {
Expand All @@ -169,7 +175,7 @@ namespace Plugin {
}

_opencdmi->Unregister(&_notification);
_opencdmi->Deinitialize(service);
_opencdmi->Deinitialize(_service);
RPC::IRemoteConnection* connection(_service->RemoteConnection(_connectionId));

UnregisterAll();
Expand All @@ -193,7 +199,7 @@ namespace Plugin {
}
}

PluginHost::ISubSystem* subSystem = service->SubSystems();
PluginHost::ISubSystem* subSystem = _service->SubSystems();

if (subSystem != nullptr) {
if(subSystem->IsActive(PluginHost::ISubSystem::DECRYPTION) == true) {
Expand Down
3 changes: 3 additions & 0 deletions OpenCDMi/OCDM.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#ifndef __OPENCDMI_H
#define __OPENCDMI_H

#include <mutex>

#include "Module.h"
#include <interfaces/IContentDecryption.h>
#include <interfaces/IMemory.h>
Expand Down Expand Up @@ -225,6 +227,7 @@ namespace Plugin {
Exchange::IContentDecryption* _opencdmi;
Exchange::IMemory* _memory;
Core::Sink<Notification> _notification;
std::recursive_mutex _serviceInitMutex;
};
} //namespace Plugin

Expand Down