init: Factor out AppInitLockDataDirectory and fix startup core dump issue #10832

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2017_07_appinitlockdatadirectory changing 4 files +67 −30
  1. laanwj commented at 8:49 AM on July 15, 2017: member

    Alternative to #10818, alternative solution to #10815.

    After this change: All the AppInit steps before and inclusive AppInitLockDataDirectory must not have Shutdown() called in case of failure. Only when AppInitMain fails, Shutdown should be called.

    Changes the GUI and bitcoind code to consistently do this.

  2. laanwj added the label Bug on Jul 15, 2017
  3. laanwj added this to the milestone 0.15.0 on Jul 15, 2017
  4. in src/init.cpp:1187 in 26fa3fcf6c outdated
    1185 |      // will at most make us exit without printing a message to console.
    1186 |      if (!LockDataDirectory(false)) {
    1187 |          // Detailed error printed inside LockDataDirectory
    1188 |          return false;
    1189 |      }
    1190 | +    return true;
    


    meshcollider commented at 9:09 AM on July 15, 2017:

    Why not just return LockDataDirectory(false); without the if statement? If statement seems unnecessary


    laanwj commented at 9:32 AM on July 15, 2017:

    The comments seem useful.


    meshcollider commented at 9:44 AM on July 15, 2017:

    Yeah I mean you could keep the comments and just remove the if statement, if(something) then true else false make things a bit less clear IMO. But this is a simple case, not a big deal either way

  5. meshcollider commented at 9:14 AM on July 15, 2017: contributor

    utACK although you could refactor braces onto same line as if-statements in baseInitialize (or is it better not to mix refactor with changes?)

  6. laanwj deleted a comment on Jul 15, 2017
  7. laanwj deleted a comment on Jul 15, 2017
  8. laanwj commented at 9:33 AM on July 15, 2017: member

    utACK although you could refactor braces onto same line as if-statements in baseInitialize (or is it better not to mix refactor with changes?)

    Could do that, but I'd prefer to not increase the scope of this to code style enforcement (of existing code). I just want to fix this issue.

  9. laanwj renamed this:
    init: Factor out AppInitLockDataDirectory
    init: Factor out AppInitLockDataDirectory and fix startup core dump issue
    on Jul 15, 2017
  10. TheBlueMatt commented at 3:26 PM on July 15, 2017: member

    utACK d4c027dd4acb77d2c5ee38ae883110abc3796d52, thanks. (modulo not sure I know enough about the Qt init process to say this is definitely right).

  11. gmaxwell approved
  12. gmaxwell commented at 7:57 AM on July 17, 2017: contributor

    tested ACK

  13. init: Factor out AppInitLockDataDirectory
    Alternative to #10818, alternative solution to #10815.
    
    After this change: All the AppInit steps before and inclusive
    AppInitLockDataDirectory must not have Shutdown() called in case of
    failure. Only when AppInitMain fails, Shutdown should be called.
    
    Changes the GUI and bitcoind code to consistently do this.
    dba485d651
  14. laanwj force-pushed on Jul 17, 2017
  15. laanwj commented at 12:57 PM on July 17, 2017: member

    Squashed ceec6cb 26fa3fc d4c027ddba485d65168794d8be39bd5e8de8777e7085434.

  16. laanwj merged this on Jul 17, 2017
  17. laanwj closed this on Jul 17, 2017

  18. laanwj referenced this in commit 89bb0365b9 on Jul 17, 2017
  19. PastaPastaPasta referenced this in commit 6fb74ead60 on Aug 2, 2019
  20. PastaPastaPasta referenced this in commit 2d96901cc7 on Aug 6, 2019
  21. barrystyle referenced this in commit 29f1a577ea on Jan 22, 2020
  22. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me