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

View File

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

View File

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

View File

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