Time prefs: Set pointer NULL, delete in destructor

... avoiding potential memory leak.
This commit is contained in:
John Scipione 2014-03-31 20:08:44 -04:00
parent f325986993
commit 15cc2a1fad
2 changed files with 22 additions and 0 deletions

View File

@ -269,6 +269,14 @@ NetworkTimeView::NetworkTimeView(const char* name)
:
BGroupView(name, B_VERTICAL, B_USE_DEFAULT_SPACING),
fSettings(),
fServerTextControl(NULL),
fAddButton(NULL),
fRemoveButton(NULL),
fResetButton(NULL),
fServerListView(NULL),
fTryAllServersCheckBox(NULL),
fSynchronizeAtBootCheckBox(NULL),
fSynchronizeButton(NULL),
fUpdateThread(-1)
{
fSettings.Load();
@ -276,6 +284,19 @@ NetworkTimeView::NetworkTimeView(const char* name)
}
NetworkTimeView::~NetworkTimeView()
{
delete fServerTextControl;
delete fAddButton;
delete fRemoveButton;
delete fResetButton;
delete fServerListView;
delete fTryAllServersCheckBox;
delete fSynchronizeAtBootCheckBox;
delete fSynchronizeButton;
}
void
NetworkTimeView::MessageReceived(BMessage* message)
{

View File

@ -84,6 +84,7 @@ private:
class NetworkTimeView : public BGroupView {
public:
NetworkTimeView(const char* name);
virtual ~NetworkTimeView();
virtual void MessageReceived(BMessage* message);
virtual void AttachedToWindow();