-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added cleanup code such that all code coverage run tests pass. #196
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,11 @@ class MayaUsdProxyShapeSceneIndex : public HdSingleInputFilteringSceneIndexBase | |
_SendPrimsDirtied(entries); | ||
} | ||
|
||
#ifndef CODE_COVERAGE_WORKAROUND | ||
private: | ||
#endif | ||
void _Destroy(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add Destroy() method to perform proper cleanup on code coverage builds. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a ticket to track when to remove the CODE_COVERAGE_WORKAROUND? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just created one: HYDRA-1297 |
||
|
||
private: | ||
void _ObjectsChanged(const MAYAUSDAPI_NS::ProxyStageObjectsChangedNotice& notice); | ||
void _StageSet(const MAYAUSDAPI_NS::ProxyStageSetNotice& notice); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,10 @@ | |
|
||
#include <optional> | ||
|
||
PXR_NAMESPACE_OPEN_SCOPE | ||
struct MayaUsdSceneIndexRegistration; | ||
PXR_NAMESPACE_CLOSE_SCOPE | ||
|
||
namespace { | ||
|
||
const std::string digits = "0123456789"; | ||
|
@@ -91,6 +95,9 @@ class SceneObserver : public Observer | |
} | ||
}; | ||
|
||
class PathInterfaceSceneIndex; | ||
typedef TfRefPtr<PathInterfaceSceneIndex> PathInterfaceSceneIndexRefPtr; | ||
|
||
/// \class PathInterfaceSceneIndex | ||
/// | ||
/// Implement the path interface for plugin scene indices. | ||
|
@@ -306,6 +313,14 @@ class PathInterfaceSceneIndex : public Fvp::PathInterfaceSceneIndexBase | |
} | ||
|
||
~PathInterfaceSceneIndex() { | ||
Destroy(); | ||
} | ||
|
||
#ifdef CODE_COVERAGE_WORKAROUND | ||
friend struct PXR_NS::MayaUsdSceneIndexRegistration; | ||
#endif | ||
|
||
void Destroy() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add Destroy() method to perform proper cleanup on code coverage builds. |
||
// Unregister our path mapper. | ||
TF_AXIOM(Fvp::PathMapperRegistry::Instance().Unregister( | ||
_sceneIndexAppPath)); | ||
|
@@ -339,6 +354,18 @@ struct MayaUsdSceneIndexRegistration : public MayaHydraSceneIndexRegistration | |
auto proxyShapeSceneIndex = TfDynamic_cast<MayaUsdProxyShapeSceneIndexRefPtr>(pluginSceneIndex); | ||
proxyShapeSceneIndex->UpdateTime(); | ||
} | ||
|
||
#ifdef CODE_COVERAGE_WORKAROUND | ||
void Destroy() override { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Invoke Destroy() methods. |
||
auto proxyShapeSceneIndex = TfDynamic_cast<MayaUsdProxyShapeSceneIndexRefPtr>(pluginSceneIndex); | ||
proxyShapeSceneIndex->_Destroy(); | ||
|
||
auto pathInterfaceSceneIndex = TfDynamic_cast<PathInterfaceSceneIndexRefPtr>(rootSceneIndex); | ||
if (pathInterfaceSceneIndex) { | ||
pathInterfaceSceneIndex->Destroy(); | ||
} | ||
} | ||
#endif | ||
}; | ||
|
||
// MayaHydraSceneIndexRegistration is used to register a scene index for | ||
|
@@ -440,6 +467,7 @@ bool MayaHydraSceneIndexRegistry::_RemoveSceneIndexForNode(const MObject& dagNod | |
_registrationsByObjectHandle.erase(dagNodeHandle); | ||
_registrations.erase(registration->sceneIndexPathPrefix); | ||
#ifdef CODE_COVERAGE_WORKAROUND | ||
registration->Destroy(); | ||
Fvp::leakSceneIndex(registration->rootSceneIndex); | ||
#endif | ||
return true; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1008,7 +1008,13 @@ void MtohRenderOverride::_SetRenderPurposeTags(const MayaHydraParams& delegatePa | |
|
||
void MtohRenderOverride::_ClearMayaHydraSceneIndex() | ||
{ | ||
#ifdef CODE_COVERAGE_WORKAROUND | ||
// Leak the Maya scene index for code coverage, as its base class | ||
// HdRetainedSceneIndex dtor crashes in Windows clang code coverage build. | ||
_mayaHydraSceneIndex->_Destroy(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Invoke Destroy() method. |
||
#else | ||
_renderIndexProxy->RemoveSceneIndex(_mayaHydraSceneIndex); | ||
#endif | ||
_mayaHydraSceneIndex.Reset(); | ||
} | ||
|
||
|
@@ -1145,13 +1151,7 @@ void MtohRenderOverride::ClearHydraResources(bool fullReset) | |
// Remove the scene index registry | ||
_sceneIndexRegistry.reset(); | ||
|
||
#ifdef CODE_COVERAGE_WORKAROUND | ||
// Leak the Maya scene index, as its base class HdRetainedSceneIndex | ||
// destructor crashes under Windows clang code coverage build. | ||
_mayaHydraSceneIndex.Reset(); | ||
#else | ||
_ClearMayaHydraSceneIndex(); | ||
#endif | ||
_ClearMayaHydraSceneIndex(); | ||
|
||
_displayStyleSceneIndex = nullptr; | ||
_pruneTexturesSceneIndex = nullptr; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Destroy() method to perform proper cleanup on code coverage builds.