From 7ff9fc846b57dcbc4c41d3b175e7400f4d4c3396 Mon Sep 17 00:00:00 2001
From: Jaswant Panchumarti <jaswant.panchumarti@kitware.com>
Date: Fri, 9 Aug 2024 11:13:31 -0400
Subject: [PATCH] Fix -Wdangling-gsl in
 vtkWebGPUComputePassBufferStorageInternals.cxx

- Addresses the warning "object backing the pointer will be destroyed at the end of the full-expression" by taking the std::string instead of the underlying char*
---
 .../vtkWebGPUComputePassBufferStorageInternals.cxx   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Rendering/WebGPU/Private/vtkWebGPUComputePassBufferStorageInternals.cxx b/Rendering/WebGPU/Private/vtkWebGPUComputePassBufferStorageInternals.cxx
index 9a424013faf..235f5151028 100644
--- a/Rendering/WebGPU/Private/vtkWebGPUComputePassBufferStorageInternals.cxx
+++ b/Rendering/WebGPU/Private/vtkWebGPUComputePassBufferStorageInternals.cxx
@@ -370,24 +370,24 @@ bool vtkWebGPUComputePassBufferStorageInternals::CheckBufferIndex(
 bool vtkWebGPUComputePassBufferStorageInternals::CheckBufferCorrectness(
   vtkSmartPointer<vtkWebGPUComputeBuffer> buffer)
 {
-  const char* bufferLabel = buffer->GetLabel().c_str();
+  const auto& bufferLabel = buffer->GetLabel();
 
   if (buffer->GetGroup() == -1)
   {
-    vtkLogF(
-      ERROR, "The group of the buffer with label \"%s\" hasn't been initialized", bufferLabel);
+    vtkLogF(ERROR, "The group of the buffer with label \"%s\" hasn't been initialized",
+      bufferLabel.c_str());
     return false;
   }
   else if (buffer->GetBinding() == -1)
   {
-    vtkLogF(
-      ERROR, "The binding of the buffer with label \"%s\" hasn't been initialized", bufferLabel);
+    vtkLogF(ERROR, "The binding of the buffer with label \"%s\" hasn't been initialized",
+      bufferLabel.c_str());
     return false;
   }
   else if (buffer->GetByteSize() == 0)
   {
     vtkLogF(ERROR, "The buffer with label \"%s\" has a size of 0. Did you forget to set its size?",
-      bufferLabel);
+      bufferLabel.c_str());
     return false;
   }
   else
-- 
GitLab