Skip to content

Commit fecb802

Browse files
committed
Update CRRemoveFSLayer to only returns errors it layer system is active
1 parent 98c4ee0 commit fecb802

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/export.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ ContentRedirectionApiErrorType CRAddFSLayerEx(CRLayerHandle *handle, const char
187187

188188

189189
ContentRedirectionApiErrorType CRRemoveFSLayer(CRLayerHandle handle) {
190+
if (!gThreadsRunning) { // if no threads a running we have removed the layers anyway
191+
return CONTENT_REDIRECTION_API_ERROR_NONE;
192+
}
190193
if (!remove_locked_first_if(gFSLayerMutex, gFSLayers, [handle](auto &cur) { return (CRLayerHandle) cur->getHandle() == handle; })) {
191194
DEBUG_FUNCTION_LINE_WARN("CONTENT_REDIRECTION_API_ERROR_LAYER_NOT_FOUND for handle %08X", handle);
192195
return CONTENT_REDIRECTION_API_ERROR_LAYER_NOT_FOUND;
@@ -238,6 +241,7 @@ ContentRedirectionApiErrorType CRAddDeviceABI(const ContentRedirectionDeviceABI
238241
*resultOut = AddDevice(host_dev);
239242

240243
if (*resultOut < 0) {
244+
DEBUG_FUNCTION_LINE_WARN("AddDevice failed: %d", *resultOut);
241245
DevoptabTrampoline::ClearDevoptab(host_dev);
242246
}
243247

@@ -250,7 +254,6 @@ ContentRedirectionApiErrorType CRRemoveDeviceABI(const char *device_name, int *r
250254
}
251255

252256
if (!DevoptabTrampoline::RemoveDevoptab(device_name, resultOut)) {
253-
*resultOut = -1;
254257
return CONTENT_REDIRECTION_API_ERROR_INVALID_ARG;
255258
}
256259

0 commit comments

Comments
 (0)