# HG changeset patch # User Sebastien Jodogne # Date 1438067497 -7200 # Node ID 0cd0f2ad35995c3f4e162d8271ee968558978576 # Parent 905842836ad406d0afbe097d2e788a3c315270f2 Fix potential deadlock in the callbacks of plugins diff -r 905842836ad4 -r 0cd0f2ad3599 NEWS --- a/NEWS Mon Jul 27 17:33:47 2015 +0200 +++ b/NEWS Tue Jul 28 09:11:37 2015 +0200 @@ -1,6 +1,8 @@ Pending changes in the mainline =============================== +* Fix access to binary data in HTTP/REST requests by Lua scripts +* Fix potential deadlock in the callbacks of plugins Version 0.9.1 (2015/07/02) diff -r 905842836ad4 -r 0cd0f2ad3599 Plugins/Engine/OrthancPlugins.cpp --- a/Plugins/Engine/OrthancPlugins.cpp Mon Jul 27 17:33:47 2015 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Tue Jul 28 09:11:37 2015 +0200 @@ -126,7 +126,9 @@ OnChangeCallbacks onChangeCallbacks_; bool hasStorageArea_; _OrthancPluginRegisterStorageArea storageArea_; - boost::recursive_mutex callbackMutex_; + boost::recursive_mutex restCallbackMutex_; + boost::recursive_mutex storedCallbackMutex_; + boost::recursive_mutex changeCallbackMutex_; Properties properties_; int argc_; char** argv_; @@ -326,7 +328,7 @@ int32_t error; { - boost::recursive_mutex::scoped_lock lock(pimpl_->callbackMutex_); + boost::recursive_mutex::scoped_lock lock(pimpl_->restCallbackMutex_); error = callback(reinterpret_cast(&output), flatUri.c_str(), &request); @@ -359,7 +361,7 @@ DicomInstanceToStore& instance, const Json::Value& simplifiedTags) { - boost::recursive_mutex::scoped_lock lock(pimpl_->callbackMutex_); + boost::recursive_mutex::scoped_lock lock(pimpl_->storedCallbackMutex_); for (PImpl::OnStoredCallbacks::const_iterator callback = pimpl_->onStoredCallbacks_.begin(); @@ -376,7 +378,7 @@ { try { - boost::recursive_mutex::scoped_lock lock(pimpl_->callbackMutex_); + boost::recursive_mutex::scoped_lock lock(pimpl_->changeCallbackMutex_); for (std::list::const_iterator callback = pimpl_->onChangeCallbacks_.begin(); diff -r 905842836ad4 -r 0cd0f2ad3599 Plugins/Include/orthanc/OrthancCDatabasePlugin.h --- a/Plugins/Include/orthanc/OrthancCDatabasePlugin.h Mon Jul 27 17:33:47 2015 +0200 +++ b/Plugins/Include/orthanc/OrthancCDatabasePlugin.h Tue Jul 28 09:11:37 2015 +0200 @@ -1,3 +1,7 @@ +/** + * @defgroup CInterface C Interface + **/ + /** * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics diff -r 905842836ad4 -r 0cd0f2ad3599 Plugins/Include/orthanc/OrthancCPlugin.h --- a/Plugins/Include/orthanc/OrthancCPlugin.h Mon Jul 27 17:33:47 2015 +0200 +++ b/Plugins/Include/orthanc/OrthancCPlugin.h Tue Jul 28 09:11:37 2015 +0200 @@ -14,7 +14,8 @@ * - Store the context pointer so that it can use the plugin * services of Orthanc. * - Register all its REST callbacks using ::OrthancPluginRegisterRestCallback(). - * - Register all its callbacks for received instances using ::OrthancPluginRegisterOnStoredInstanceCallback(). + * - Possibly register its callback for received DICOM instances using ::OrthancPluginRegisterOnStoredInstanceCallback(). + * - Possibly register its callback for changes to the DICOM store using ::OrthancPluginRegisterOnChangeCallback(). * - Possibly register a custom storage area using ::OrthancPluginRegisterStorageArea(). * - Possibly register a custom database back-end area using ::OrthancPluginRegisterDatabaseBackend(). * -# void OrthancPluginFinalize(): @@ -28,7 +29,7 @@ * The name and the version of a plugin is only used to prevent it * from being loaded twice. * - * The various callbacks are guaranteed to be executed in mutual + * The various REST callbacks are guaranteed to be executed in mutual * exclusion since Orthanc 0.8.5. **/