Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Feb 13, 2018

This prevents segfaults (or errors when running qt in valgrind)

Conditional jump or move depends on uninitialised value(s)
    WalletModel::checkBalanceChanged() (walletmodel.cpp:156)

@maflcko maflcko added the GUI label Feb 13, 2018
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK, but it would be better to initialize members inline the future to make these bugs more obvious:

CAmount cachedWatchOnlyBalance = 0;

@laanwj
Copy link
Member

laanwj commented Feb 14, 2018

utACK fa27623, good catch.

utACK, but it would be better to initialize members inline the future to make these bugs more obvious:

Indeed, if that's consistently done it's much easier to see missing ones. But would have to move all of the initializers at the same time then.

@laanwj laanwj merged commit fa27623 into bitcoin:master Feb 15, 2018
laanwj added a commit that referenced this pull request Feb 15, 2018
fa27623 qt: Initialize members in WalletModel (MarcoFalke)

Pull request description:

  This prevents segfaults (or errors when running qt in valgrind)

  ```
  Conditional jump or move depends on uninitialised value(s)
      WalletModel::checkBalanceChanged() (walletmodel.cpp:156)

Tree-SHA512: 38c8c03c7fa947edb3f1c13eab2ac7a62ef8f8141603c2329a7dc5821a887a349af8014dc739b762e046f410f44a9c6653b6930f08b53496cf66381cadc06246
@maflcko maflcko deleted the Mf1802-qtInitializeMembersWalletModel branch February 16, 2018 04:46
laanwj added a commit that referenced this pull request Mar 5, 2018
fa94614 [doc] dev-notes: Members should be initialized (MarcoFalke)

Pull request description:

  Also, remove mention of threads that were removed long ago.

  Motivation:
  Make it easier to spot bugs such as #11654 and  #12426

Tree-SHA512: 8ca1cb54e830e9368803bd98a8b08c39bf2d46f079094ed7e070b32ae15a6e611ce98d7a614f897803309f4728575e6bc9357fab1157c53d2536417eb8271653
laanwj added a commit that referenced this pull request Jan 9, 2019
fa2510d Use C++11 default member initializers (MarcoFalke)

Pull request description:

  Changes:
  * Remove unused constructors that leave some members uninitialized
  * Remove manual initialization in each constructor and prefer C++11 default member initializers

  This is not a stylistic change, but a change that avoids bugs such as:

  *  fix uninitialized read when stringifying an addrLocal #14728
  *  qt: Initialize members in WalletModel #12426
  *  net: correctly initialize nMinPingUsecTime #6636
  * ...

Tree-SHA512: 0f896f3b9fcc464d5fc7525f7c86343ef9ce9fb13425fbc68e9a9728fd8710c2b4e2fd039ee08279ea41ff20fd92b7185cf5cca95a0bcb6a5340a1e6f03cae6b
laanwj added a commit that referenced this pull request Jan 14, 2019
fac2f5e Use C++11 default member initializers (MarcoFalke)

Pull request description:

  The second and last change on this topic (c.f. #15109). Split up because the diff would otherwise interleave, making review harder than necessary.

  This is not a stylistic change, but a change that avoids bugs such as:

  *  fix uninitialized read when stringifying an addrLocal #14728
  *  qt: Initialize members in WalletModel #12426
  *  net: correctly initialize nMinPingUsecTime #6636
  * ...

Tree-SHA512: 547ae72b87aeaed5890eb5fdcff612bfc93354632b238d89e1e1c0487187f39609bcdc537ef21345e0aea8cfcf1ea48da432d672c5386dd87cf58742446a86b1
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 14, 2020
fa94614 [doc] dev-notes: Members should be initialized (MarcoFalke)

Pull request description:

  Also, remove mention of threads that were removed long ago.

  Motivation:
  Make it easier to spot bugs such as bitcoin#11654 and  bitcoin#12426

Tree-SHA512: 8ca1cb54e830e9368803bd98a8b08c39bf2d46f079094ed7e070b32ae15a6e611ce98d7a614f897803309f4728575e6bc9357fab1157c53d2536417eb8271653
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 17, 2020
fa27623 qt: Initialize members in WalletModel (MarcoFalke)

Pull request description:

  This prevents segfaults (or errors when running qt in valgrind)

  ```
  Conditional jump or move depends on uninitialised value(s)
      WalletModel::checkBalanceChanged() (walletmodel.cpp:156)

Tree-SHA512: 38c8c03c7fa947edb3f1c13eab2ac7a62ef8f8141603c2329a7dc5821a887a349af8014dc739b762e046f410f44a9c6653b6930f08b53496cf66381cadc06246
pravblockc pushed a commit to pravblockc/dash that referenced this pull request Aug 11, 2021
fa2510d Use C++11 default member initializers (MarcoFalke)

Pull request description:

  Changes:
  * Remove unused constructors that leave some members uninitialized
  * Remove manual initialization in each constructor and prefer C++11 default member initializers

  This is not a stylistic change, but a change that avoids bugs such as:

  *  fix uninitialized read when stringifying an addrLocal bitcoin#14728
  *  qt: Initialize members in WalletModel bitcoin#12426
  *  net: correctly initialize nMinPingUsecTime dashpay#6636
  * ...

Tree-SHA512: 0f896f3b9fcc464d5fc7525f7c86343ef9ce9fb13425fbc68e9a9728fd8710c2b4e2fd039ee08279ea41ff20fd92b7185cf5cca95a0bcb6a5340a1e6f03cae6b
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants