Skip to content

Commit 118794d

Browse files
jonasschnelliPastaPastaPasta
authored andcommitted
Merge bitcoin#18424: qt: Use parent-child relation to manage lifetime of OptionsModel object
8e08d00 qt: Use parent-child relation to manage lifetime of OptionsModel object (Hennadii Stepanov) Pull request description: Both `BitcoinApplication` and `OptionsModel` classes are derived from the `QObject` class, therefore a parent-child relation could be established to manage the lifetime of an `OptionsModel` object: https://github.com/bitcoin/bitcoin/blob/5236b2e267a58870239673c7ec85e5df0cb8fc8e/src/qt/optionsmodel.cpp#L29-L30 This PR does not change behavior. ACKs for top commit: jonasschnelli: utACK 8e08d00 promag: ACK 8e08d00. Tree-SHA512: 0223dddf5ba28b0bfaefeda1b03b4ff95bf7e7d0c1e7b32368171e561813e22129f2a664f09279fa3b4fa63259b7680d55aa3fe66db9c7ae0039b7f529777ec3
1 parent ec997ad commit 118794d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/qt/bitcoin.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,6 @@ BitcoinApplication::~BitcoinApplication()
228228
settings.clear();
229229
settings.sync();
230230
}
231-
delete optionsModel;
232-
optionsModel = nullptr;
233231
}
234232

235233
#ifdef ENABLE_WALLET
@@ -241,7 +239,7 @@ void BitcoinApplication::createPaymentServer()
241239

242240
void BitcoinApplication::createOptionsModel(bool resetSettings)
243241
{
244-
optionsModel = new OptionsModel(m_node, nullptr, resetSettings);
242+
optionsModel = new OptionsModel(m_node, this, resetSettings);
245243
}
246244

247245
void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)

0 commit comments

Comments
 (0)