[glibmm] glibmm_mainloop test: Allocate a thread on the stack.



commit 4a6af0af0ca49596109681819286af9a2b311cc3
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Nov 26 10:35:20 2015 +0100

    glibmm_mainloop test: Allocate a thread on the stack.
    
    As suggested by Kjell Ahlstedt:
    https://bugzilla.gnome.org/show_bug.cgi?id=757674#c10

 tests/glibmm_mainloop/main.cc |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/tests/glibmm_mainloop/main.cc b/tests/glibmm_mainloop/main.cc
index fab8575..de1a751 100644
--- a/tests/glibmm_mainloop/main.cc
+++ b/tests/glibmm_mainloop/main.cc
@@ -86,16 +86,13 @@ int main(int, char**)
 
   // Create a second thread.
   const std::thread::id first_thread_id = std::this_thread::get_id();
-  std::thread* second_thread =
-    new std::thread(&thread_function, first_thread_id, first_mainloop);
+  std::thread second_thread(&thread_function, first_thread_id, first_mainloop);
 
   // Start the first main loop.
   first_mainloop->run();
 
   // Wait until the second thread has finished.
-  second_thread->join();
-  delete second_thread;
-  second_thread = nullptr;
+  second_thread.join();
 
   if (is_owner)
     Glib::MainContext::get_default()->release();


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