Le 06/07/2017 à 14:52, Jean-Marc Lasgouttes a écrit :
commit 02c9d2e67c16400588dfb103df284121520912a0
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Thu Jul 6 14:46:03 2017 +0200

     Fix uninitialized members outfd and infd
Also move initialization of some variables to initializers list.

Question for someone who groks C++11: instead of using initializer lists, should we use default initialization in the the class definition?

E.g. replace ready_(false) in constructor(s) by
  bool ready = false;
in the class definition. C++11 allows it AFAIU.

JMarc

Only the non-win32 part has been tested, but it should be OK. Spotted by coverity.
---
  src/Server.cpp |   12 ++++++------
  1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/Server.cpp b/src/Server.cpp
index 98e1d66..4364f08 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -137,14 +137,14 @@ DWORD WINAPI pipeServerWrapper(void * arg)
LyXComm::LyXComm(string const & pip, Server * cli, ClientCallbackfct ccb)
-       : stopserver_(0), pipename_(pip), client_(cli), clientcb_(ccb)
+       : stopserver_(0),
+         ready_(false), pipename_(pip), client_(cli), clientcb_(ccb),
+         deferred_loading_(false)
  {
        for (int i = 0; i < MAX_PIPES; ++i) {
                event_[i] = 0;
                pipe_[i].handle = INVALID_HANDLE_VALUE;
        }
-       ready_ = false;
-       deferred_loading_ = false;
        openConnection();
  }
@@ -730,10 +730,10 @@ void LyXComm::send(string const & msg)
  #else // defined (HAVE_MKFIFO)
LyXComm::LyXComm(string const & pip, Server * cli, ClientCallbackfct ccb)
-       : pipename_(pip), client_(cli), clientcb_(ccb)
+       : infd_(-1), outfd_(-1),
+         ready_(false), pipename_(pip), client_(cli), clientcb_(ccb),
+         deferred_loading_(false)
  {
-       ready_ = false;
-       deferred_loading_ = false;
        openConnection();
  }

Reply via email to