lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master d8a7b0a 1/7: Improve resource management in o


From: Greg Chicares
Subject: [lmi-commits] [lmi] master d8a7b0a 1/7: Improve resource management in one instance
Date: Wed, 10 Feb 2021 09:41:59 -0500 (EST)

branch: master
commit d8a7b0ab74748a0fae38af19153694815fa8d1f3
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Improve resource management in one instance
    
    The object used for the pasting text is intended to be deleted when
    that test completes. An exception could have kept the Destroy() call
    from being reached. See:
      https://lists.nongnu.org/archive/html/lmi/2021-02/msg00014.html
---
 skeleton.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/skeleton.cpp b/skeleton.cpp
index 267582e..d3f57da 100644
--- a/skeleton.cpp
+++ b/skeleton.cpp
@@ -1081,7 +1081,11 @@ void 
Skeleton::UponTestFloatingPointEnvironment(wxCommandEvent&)
 
 void Skeleton::UponTestPasting(wxCommandEvent&)
 {
-    InputSequenceEntry* z = new(wx) InputSequenceEntry(frame_, wxID_ANY, 
"Testing...");
+    auto const z = std::make_unique<InputSequenceEntry>
+        (frame_
+        ,wxID_ANY
+        ,"Testing..."
+        );
     wxTextCtrl& t = z->text_ctrl();
 
     ClipboardEx::SetText("1\r\n2\r\n3\r\n");
@@ -1100,7 +1104,6 @@ void Skeleton::UponTestPasting(wxCommandEvent&)
         warning() << "'X;Y;Z;' != '" << t.GetValue() << "'" << LMI_FLUSH;
         }
 
-    z->Destroy();
     status() << "Pasting test finished." << std::flush;
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]