commit 8a047a411235fcf5ba48f075e0a23a7cf1e3e8bb
Author: Georg Baum <[email protected]>
Date: Sat Oct 10 21:04:28 2015 +0200
Add missing intializations
These were found by cppcheck:
Member variable 'x' is not initialized in the constructor.
The crash #9788 would not have happened if this had been done earlier.
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 097a465..b07eb2b 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -234,7 +234,9 @@ struct BufferView::Private
mouse_position_cache_(),
bookmark_edit_position_(-1), gui_(0),
horiz_scroll_offset_(0)
- {}
+ {
+ xsel_cache_.set = false;
+ }
///
ScrollbarParameters scrollbarParameters_;
diff --git a/src/Trans.cpp b/src/Trans.cpp
index 0e7d561..9249e8e 100644
--- a/src/Trans.cpp
+++ b/src/Trans.cpp
@@ -429,10 +429,9 @@ tex_accent getkeymod(string const & p)
// TransFSMData
-TransFSMData::TransFSMData()
+TransFSMData::TransFSMData() : deadkey_(0), deadkey2_(0), init_state_(0),
+ deadkey_state_(0), combined_state_(0), currentState(0)
{
- deadkey_ = deadkey2_ = 0;
- deadkey_info_.accent = deadkey2_info_.accent = TEX_NOACCENT;
}
diff --git a/src/Trans.h b/src/Trans.h
index 7bfea6b..4befc65 100644
--- a/src/Trans.h
+++ b/src/Trans.h
@@ -90,6 +90,8 @@ extern TeXAccent get_accent(FuncCode action);
///
struct Keyexc {
+ ///
+ Keyexc() : c('\0'), combined(false), accent(TEX_NOACCENT) {}
/// character to make exception
char_type c;
/// exception data
@@ -107,6 +109,8 @@ typedef std::list<Keyexc> KmodException;
class KmodInfo {
public:
///
+ KmodInfo() : accent(TEX_NOACCENT) {}
+ ///
docstring data;
///
tex_accent accent;
diff --git a/src/frontends/qt4/GuiWorkArea.cpp
b/src/frontends/qt4/GuiWorkArea.cpp
index 11596d5..2bd7c8e 100644
--- a/src/frontends/qt4/GuiWorkArea.cpp
+++ b/src/frontends/qt4/GuiWorkArea.cpp
@@ -132,7 +132,9 @@ namespace frontend {
class CursorWidget {
public:
- CursorWidget() {
+ CursorWidget() : rtl_(false), l_shape_(false), completable_(false),
+ show_(false), x_(0), cursor_width_(0)
+ {
recomputeWidth();
}
@@ -244,10 +246,11 @@ SyntheticMouseEvent::SyntheticMouseEvent()
GuiWorkArea::Private::Private(GuiWorkArea * parent)
-: p(parent), screen_(0), buffer_view_(0), lyx_view_(0), cursor_visible_(false),
+: p(parent), screen_(0), buffer_view_(0), read_only_(false), lyx_view_(0),
+cursor_visible_(false), cursor_(0),
need_resize_(false), schedule_redraw_(false), preedit_lines_(1),
pixel_ratio_(1.0),
-completer_(new GuiCompleter(p, p))
+completer_(new GuiCompleter(p, p)), dialog_mode_(false)
{
}
diff --git a/src/mathed/InsetMathDelim.cpp b/src/mathed/InsetMathDelim.cpp
index fb4f8f4..3671606 100644
--- a/src/mathed/InsetMathDelim.cpp
+++ b/src/mathed/InsetMathDelim.cpp
@@ -43,13 +43,13 @@ static docstring convertDelimToLatexName(docstring const &
name)
InsetMathDelim::InsetMathDelim(Buffer * buf, docstring const & l,
docstring const & r)
- : InsetMathNest(buf, 1), left_(l), right_(r)
+ : InsetMathNest(buf, 1), left_(l), right_(r), dw_(0)
{}
InsetMathDelim::InsetMathDelim(Buffer * buf, docstring const & l, docstring
const & r,
MathData const & ar)
- : InsetMathNest(buf, 1), left_(l), right_(r)
+ : InsetMathNest(buf, 1), left_(l), right_(r), dw_(0)
{
cell(0) = ar;
}
diff --git a/src/mathed/InsetMathDots.cpp b/src/mathed/InsetMathDots.cpp
index 67ed829..b44d391 100644
--- a/src/mathed/InsetMathDots.cpp
+++ b/src/mathed/InsetMathDots.cpp
@@ -25,7 +25,7 @@
namespace lyx {
InsetMathDots::InsetMathDots(latexkeys const * key)
- : key_(key)
+ : dh_(0), key_(key)
{}
diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index a9970f4..781d921 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -81,7 +81,7 @@ static void resetGrid(InsetMathGrid & grid)
InsetMathGrid::CellInfo::CellInfo()
- : multi_(CELL_NORMAL)
+ : multi_(CELL_NORMAL), glue_(0), begin_(0), end_(0)
{}
@@ -90,7 +90,8 @@ InsetMathGrid::CellInfo::CellInfo()
InsetMathGrid::RowInfo::RowInfo()
- : lines_(0), skip_(0), allow_newpage_(true)
+ : descent_(0), ascent_(0), offset_(0), lines_(0), skip_(0),
+ allow_newpage_(true)
{}
@@ -106,7 +107,7 @@ int InsetMathGrid::RowInfo::skipPixels(MetricsInfo const &
mi) const
InsetMathGrid::ColInfo::ColInfo()
- : align_('c'), lines_(0), skip_(0)
+ : align_('c'), width_(0), offset_(0), lines_(0), skip_(0)
{}
diff --git a/src/mathed/InsetMathUnknown.cpp b/src/mathed/InsetMathUnknown.cpp
index 29dae2b..d7e2875 100644
--- a/src/mathed/InsetMathUnknown.cpp
+++ b/src/mathed/InsetMathUnknown.cpp
@@ -23,7 +23,8 @@ namespace lyx {
InsetMathUnknown::InsetMathUnknown(docstring const & nm,
docstring const & selection, bool final, bool black)
- : name_(nm), final_(final), black_(black), selection_(selection)
+ : name_(nm), final_(final), black_(black), kerning_(0),
+ selection_(selection)
{}
diff --git a/src/mathed/InsetMathXYArrow.cpp b/src/mathed/InsetMathXYArrow.cpp
index 0cb525c..80aeb72 100644
--- a/src/mathed/InsetMathXYArrow.cpp
+++ b/src/mathed/InsetMathXYArrow.cpp
@@ -22,7 +22,7 @@ namespace lyx {
InsetMathXYArrow::InsetMathXYArrow()
- : InsetMathNest(2)
+ : InsetMathNest(2), up_(false), target_(0)
{}
diff --git a/src/support/gzstream.h b/src/support/gzstream.h
index 858784d..d333dd4 100644
--- a/src/support/gzstream.h
+++ b/src/support/gzstream.h
@@ -57,7 +57,7 @@ private:
int flush_buffer();
public:
- gzstreambuf() : opened(0) {
+ gzstreambuf() : opened(0), mode(0) {
setp( buffer, buffer + (bufferSize-1));
setg( buffer + 4, // beginning of putback area
buffer + 4, // read position
diff --git a/src/tex2lyx/table.cpp b/src/tex2lyx/table.cpp
index 6da3059..ad0331b 100644
--- a/src/tex2lyx/table.cpp
+++ b/src/tex2lyx/table.cpp
@@ -144,7 +144,7 @@ public:
class ltType {
public:
// constructor
- ltType() : topDL(false), bottomDL(false), empty(false) {}
+ ltType() : set(false), topDL(false), bottomDL(false), empty(false) {}
// we have this header type (is set in the getLT... functions)
bool set;
// double borders on top