fix: fix a memory leak bug, in measure for text actor

This commit is contained in:
kradchen
2025-07-23 13:38:08 +08:00
parent ab76629fd7
commit 17fd8ffa6f
3 changed files with 13 additions and 0 deletions

View File

@@ -142,6 +142,10 @@ EllipseAnnotationActor::~EllipseAnnotationActor() {
controlP_rt = nullptr; controlP_rt = nullptr;
controlP_lb = nullptr; controlP_lb = nullptr;
controlP_rb = nullptr; controlP_rb = nullptr;
if (text) {
text->Delete();
text = nullptr;
}
} }
void EllipseAnnotationActor::SetRenderer(vtkRenderer *ren) { void EllipseAnnotationActor::SetRenderer(vtkRenderer *ren) {

View File

@@ -140,6 +140,11 @@ OpenPolyAnnotationActor::~OpenPolyAnnotationActor() {
p->Delete(); p->Delete();
}); });
controlPointList.clear(); controlPointList.clear();
if (text)
{
text->Delete();
text=nullptr;
}
} }
void OpenPolyAnnotationActor::selfDragCb(vtkObject *, unsigned long event, void *data) { void OpenPolyAnnotationActor::selfDragCb(vtkObject *, unsigned long event, void *data) {

View File

@@ -153,6 +153,10 @@ RoundAnnotationActor::~RoundAnnotationActor() {
controlP_rt = nullptr; controlP_rt = nullptr;
controlP_lb = nullptr; controlP_lb = nullptr;
controlP_rb = nullptr; controlP_rb = nullptr;
if (text) {
text->Delete();
text = nullptr;
}
} }
void RoundAnnotationActor::SetRenderer(vtkRenderer *ren) { void RoundAnnotationActor::SetRenderer(vtkRenderer *ren) {