widget: reset some object vars to NULL, only for sure

This commit is contained in:
2020-01-05 21:17:59 +01:00
parent 6c5461d582
commit 890d04b0ca
5 changed files with 14 additions and 8 deletions

View File

@@ -1352,6 +1352,7 @@ void CMenuWidget::calcSize()
CMenuItem *separator = new CMenuSeparator();
height += separator->getHeight();
delete separator;
separator = NULL;
//scrollbar width
scrollbar_width=0;
@@ -1617,6 +1618,7 @@ void CMenuWidget::saveScreen()
return;
delete[] background;
background = NULL;
int hint_h = 0;
if (hint_height)
hint_h = OFFSET_INTER + hint_height + OFFSET_SHADOW;
@@ -2141,8 +2143,8 @@ int CMenuOptionChooser::exec(CMenuTarget*)
*optionValue = options[select].key;
optionValname = (char *) options[select].valname;
}
delete menu;
delete selector;
delete menu; menu = NULL;
delete selector; selector = NULL;
} else {
for(unsigned int count = 0; count < number_of_options; count++) {
if (options[count].key == (*optionValue)) {
@@ -2314,8 +2316,8 @@ int CMenuOptionStringChooser::exec(CMenuTarget* parent)
ret = menu_return::RETURN_REPAINT;
if(select >= 0 && optionValuePtr)
*optionValuePtr = options[select];
delete menu;
delete selector;
delete menu; menu = NULL;
delete selector; selector = NULL;
} else {
//select next value
for(unsigned int count = 0; count < options.size(); count++) {
@@ -2567,7 +2569,7 @@ bool CPINProtection::check()
cPIN = "";
CPINInput* PINInput = new CPINInput(title, &cPIN, 4, hint);
PINInput->exec( getParent(), "");
delete PINInput;
delete PINInput; PINInput = NULL;
hint = LOCALE_PINPROTECTION_WRONGCODE;
} while ((cPIN != *validPIN) && !cPIN.empty());
return (cPIN == *validPIN);
@@ -2586,7 +2588,7 @@ bool CZapProtection::check()
CPLPINInput* PINInput = new CPLPINInput(title, &cPIN, 4, hint, fsk);
res = PINInput->exec(getParent(), "");
delete PINInput;
delete PINInput; PINInput = NULL;
cPIN[4] = 0;
hint = LOCALE_PINPROTECTION_WRONGCODE;

View File

@@ -314,7 +314,7 @@ class CMenuDForwarder : public CMenuForwarder
const char * const IconName = NULL, const char * const IconName_Info_right = NULL)
: CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { };
~CMenuDForwarder() { delete jumpTarget; }
~CMenuDForwarder() { delete jumpTarget; jumpTarget = NULL;}
};
class CAbstractMenuOptionChooser : public CMenuItem

View File

@@ -301,4 +301,5 @@ CShellWindow::~CShellWindow()
{
if (textBox)
delete textBox;
textBox = NULL;
}

View File

@@ -394,6 +394,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
if (pixBuf)
delete[] pixBuf;
pixBuf = NULL;
if (!parent || force_saveScreen) {
pixBuf = new fb_pixel_t[(width + OFFSET_SHADOW) * (height + OFFSET_SHADOW)];
if (pixBuf)
@@ -916,6 +917,7 @@ int CPLPINInput::exec( CMenuTarget* parent, const std::string & )
{
frameBuffer->RestoreScreen(x - borderwidth, y- borderwidth, width+ 2* borderwidth, height+ 2* borderwidth, pixbuf);
delete[] pixbuf;//Mismatching allocation and deallocation: pixbuf
pixBuf = NULL;
}
return ( res );

View File

@@ -145,6 +145,7 @@ void CExtendedInput::saveScreen()
return;
delete[] background;
background = NULL;
background = new fb_pixel_t [width * height];
if(background)