Merge pull request #247 from ryanmjacobs:fix_pointer_checks
This commit is contained in:
commit
34567bc496
@ -260,8 +260,7 @@ struct PNGChunk
|
||||
}
|
||||
~PNGChunk()
|
||||
{
|
||||
if (Data)
|
||||
delete[] Data;
|
||||
delete[] Data;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -462,9 +462,9 @@ int register_extension()
|
||||
returnval = 1;
|
||||
finalise:
|
||||
|
||||
if(iconname) free(iconname);
|
||||
if(opencommand) free(opencommand);
|
||||
if(currentfilename) free(currentfilename);
|
||||
free(iconname);
|
||||
free(opencommand);
|
||||
free(currentfilename);
|
||||
|
||||
return returnval;
|
||||
#elif defined(LIN)
|
||||
|
@ -343,10 +343,10 @@ bool Client::DoInstallation()
|
||||
returnval = 1;
|
||||
finalise:
|
||||
|
||||
if(iconname) free(iconname);
|
||||
if(opencommand) free(opencommand);
|
||||
if(protocolcommand) free(protocolcommand);
|
||||
if(currentfilename) free(currentfilename);
|
||||
free(iconname);
|
||||
free(opencommand);
|
||||
free(protocolcommand);
|
||||
free(currentfilename);
|
||||
|
||||
return returnval;
|
||||
#elif defined(LIN)
|
||||
@ -681,8 +681,7 @@ void Client::Tick()
|
||||
|
||||
if(status != 200)
|
||||
{
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
}
|
||||
else if(data)
|
||||
{
|
||||
@ -768,8 +767,7 @@ void Client::Tick()
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -952,7 +950,7 @@ RequestStatus Client::UploadSave(SaveInfo & save)
|
||||
{
|
||||
if(strncmp((const char *)data, "OK", 2)!=0)
|
||||
{
|
||||
if(gameData) delete[] gameData;
|
||||
delete[] gameData;
|
||||
lastError = std::string((const char *)data);
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
@ -973,14 +971,14 @@ RequestStatus Client::UploadSave(SaveInfo & save)
|
||||
}
|
||||
}
|
||||
free(data);
|
||||
if(gameData) delete[] gameData;
|
||||
delete[] gameData;
|
||||
return RequestOkay;
|
||||
}
|
||||
else if(data)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
if(gameData) delete[] gameData;
|
||||
delete[] gameData;
|
||||
return RequestFailure;
|
||||
}
|
||||
|
||||
@ -1400,8 +1398,7 @@ LoginStatus Client::Login(std::string username, std::string password, User & use
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return LoginError;
|
||||
}
|
||||
|
||||
@ -1447,12 +1444,10 @@ RequestStatus Client::DeleteSave(int saveID)
|
||||
lastError = http_ret_text(dataStatus);
|
||||
goto failure;
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return RequestOkay;
|
||||
failure:
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
}
|
||||
|
||||
@ -1507,12 +1502,10 @@ RequestStatus Client::AddComment(int saveID, std::string comment)
|
||||
lastError = http_ret_text(dataStatus);
|
||||
goto failure;
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return RequestOkay;
|
||||
failure:
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
}
|
||||
|
||||
@ -1563,12 +1556,10 @@ RequestStatus Client::FavouriteSave(int saveID, bool favourite)
|
||||
lastError = http_ret_text(dataStatus);
|
||||
goto failure;
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return RequestOkay;
|
||||
failure:
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
}
|
||||
|
||||
@ -1621,12 +1612,10 @@ RequestStatus Client::ReportSave(int saveID, std::string message)
|
||||
lastError = http_ret_text(dataStatus);
|
||||
goto failure;
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return RequestOkay;
|
||||
failure:
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
}
|
||||
|
||||
@ -1675,12 +1664,10 @@ RequestStatus Client::UnpublishSave(int saveID)
|
||||
lastError = http_ret_text(dataStatus);
|
||||
goto failure;
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return RequestOkay;
|
||||
failure:
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
}
|
||||
|
||||
@ -1698,8 +1685,7 @@ RequestStatus Client::PublishSave(int saveID)
|
||||
const char *const postDatas[] = { "" };
|
||||
size_t postLengths[] = { 1 };
|
||||
char *data = http_multipart_post(urlStream.str().c_str(), postNames, postDatas, postLengths, userIDStream.str().c_str(), NULL, authUser.SessionID.c_str(), &dataStatus, NULL);
|
||||
if (data)
|
||||
free(data);
|
||||
free(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1795,7 +1781,7 @@ SaveInfo * Client::GetSave(int saveID, int saveDate)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data) free(data);
|
||||
free(data);
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
return NULL;
|
||||
@ -2008,8 +1994,7 @@ std::vector<SaveComment*> * Client::GetComments(int saveID, int start, int count
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return commentArray;
|
||||
}
|
||||
|
||||
@ -2057,8 +2042,7 @@ std::vector<std::pair<std::string, int> > * Client::GetTags(int start, int count
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return tagArray;
|
||||
}
|
||||
|
||||
@ -2140,8 +2124,7 @@ std::vector<SaveInfo*> * Client::SearchSaves(int start, int count, std::string q
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return saveArray;
|
||||
}
|
||||
|
||||
@ -2329,8 +2312,7 @@ std::list<std::string> * Client::RemoveTag(int saveID, std::string tag)
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return tags;
|
||||
}
|
||||
|
||||
@ -2390,8 +2372,7 @@ std::list<std::string> * Client::AddTag(int saveID, std::string tag)
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
return tags;
|
||||
}
|
||||
|
||||
|
@ -1075,17 +1075,13 @@ void GameSave::readOPS(char * data, int dataLength)
|
||||
fail:
|
||||
//Clean up everything
|
||||
bson_destroy(&b);
|
||||
if(freeIndices)
|
||||
free(freeIndices);
|
||||
if(partsSimIndex)
|
||||
free(partsSimIndex);
|
||||
free(freeIndices);
|
||||
free(partsSimIndex);
|
||||
throw ParseException(ParseException::Corrupt, "Save data corrupt");
|
||||
fin:
|
||||
bson_destroy(&b);
|
||||
if(freeIndices)
|
||||
free(freeIndices);
|
||||
if(partsSimIndex)
|
||||
free(partsSimIndex);
|
||||
free(freeIndices);
|
||||
free(partsSimIndex);
|
||||
}
|
||||
|
||||
void GameSave::readPSv(char * data, int dataLength)
|
||||
@ -2191,28 +2187,17 @@ char * GameSave::serialiseOPS(unsigned int & dataLength)
|
||||
|
||||
fin:
|
||||
bson_destroy(&b);
|
||||
if(partsData)
|
||||
free(partsData);
|
||||
if(wallData)
|
||||
free(wallData);
|
||||
if(fanData)
|
||||
free(fanData);
|
||||
if (elementCount)
|
||||
delete[] elementCount;
|
||||
if (partsSaveIndex)
|
||||
free(partsSaveIndex);
|
||||
if (soapLinkData)
|
||||
free(soapLinkData);
|
||||
if (partsPosData)
|
||||
free(partsPosData);
|
||||
if (partsPosFirstMap)
|
||||
free(partsPosFirstMap);
|
||||
if (partsPosLastMap)
|
||||
free(partsPosLastMap);
|
||||
if (partsPosCount)
|
||||
free(partsPosCount);
|
||||
if (partsPosLink)
|
||||
free(partsPosLink);
|
||||
free(partsData);
|
||||
free(wallData);
|
||||
free(fanData);
|
||||
delete[] elementCount;
|
||||
free(partsSaveIndex);
|
||||
free(soapLinkData);
|
||||
free(partsPosData);
|
||||
free(partsPosFirstMap);
|
||||
free(partsPosLastMap);
|
||||
free(partsPosCount);
|
||||
free(partsPosLink);
|
||||
|
||||
return (char*)outputData;
|
||||
}
|
||||
|
@ -557,8 +557,7 @@ int http_async_req_status(void *ctx)
|
||||
{
|
||||
cx->tptr = 0;
|
||||
cx->tlen = 0;
|
||||
if (cx->tbuf)
|
||||
free(cx->tbuf);
|
||||
free(cx->tbuf);
|
||||
cx->state = HTS_RECV;
|
||||
}
|
||||
cx->last = now;
|
||||
@ -684,11 +683,9 @@ void http_async_req_close(void *ctx)
|
||||
{
|
||||
cx->keep = 1;
|
||||
tmp = http_async_req_stop(ctx, NULL, NULL);
|
||||
if (tmp)
|
||||
free(tmp);
|
||||
free(tmp);
|
||||
}
|
||||
if (cx->fdhost)
|
||||
free(cx->fdhost);
|
||||
free(cx->fdhost);
|
||||
PCLOSE(cx->fd);
|
||||
free(ctx);
|
||||
}
|
||||
@ -1088,8 +1085,7 @@ retry:
|
||||
return http_async_req_stop(ctx, ret, len);
|
||||
|
||||
fail:
|
||||
if (data)
|
||||
free(data);
|
||||
free(data);
|
||||
if (own_plen)
|
||||
free(plens);
|
||||
if (ret)
|
||||
@ -1278,8 +1274,7 @@ retry:
|
||||
return ctx;
|
||||
|
||||
fail:
|
||||
if (data)
|
||||
free(data);
|
||||
free(data);
|
||||
if (own_plen)
|
||||
free(plens);
|
||||
//if (ret)
|
||||
|
@ -65,9 +65,7 @@ void SaveFile::SetDisplayName(std::string displayName)
|
||||
}
|
||||
|
||||
SaveFile::~SaveFile() {
|
||||
if(gameSave)
|
||||
delete gameSave;
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
delete gameSave;
|
||||
delete thumbnail;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,6 @@ GameSave * SaveInfo::GetGameSave()
|
||||
|
||||
void SaveInfo::SetGameSave(GameSave * saveGame)
|
||||
{
|
||||
if(gameSave)
|
||||
delete gameSave;
|
||||
delete gameSave;
|
||||
gameSave = saveGame;
|
||||
}
|
||||
|
@ -61,8 +61,7 @@ RequestBroker::ProcessResponse APIRequest::Process(RequestBroker & rb)
|
||||
//#ifdef DEBUG
|
||||
std::cout << typeid(*this).name() << " Request for " << URL << " failed with status " << status << std::endl;
|
||||
//#endif
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
|
||||
return RequestBroker::Failed;
|
||||
}
|
||||
|
@ -76,8 +76,7 @@ RequestBroker::ProcessResponse ImageRequest::Process(RequestBroker & rb)
|
||||
#ifdef DEBUG
|
||||
std::cout << typeid(*this).name() << " Request for " << URL << " failed with status " << status << std::endl;
|
||||
#endif
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
|
||||
return RequestBroker::Failed;
|
||||
}
|
||||
|
@ -38,8 +38,7 @@ RequestBroker::ProcessResponse ThumbRenderRequest::Process(RequestBroker & rb)
|
||||
|
||||
ThumbRenderRequest::~ThumbRenderRequest()
|
||||
{
|
||||
if(Save)
|
||||
delete Save;
|
||||
delete Save;
|
||||
}
|
||||
|
||||
void ThumbRenderRequest::Cleanup()
|
||||
|
@ -60,8 +60,7 @@ RequestBroker::ProcessResponse WebRequest::Process(RequestBroker & rb)
|
||||
//#ifdef DEBUG
|
||||
std::cout << typeid(*this).name() << " Request for " << URL << " failed with status " << status << std::endl;
|
||||
//#endif
|
||||
if(data)
|
||||
free(data);
|
||||
free(data);
|
||||
|
||||
return RequestBroker::Failed;
|
||||
}
|
||||
|
@ -317,7 +317,6 @@ void ColourPickerActivity::OnDraw()
|
||||
}
|
||||
|
||||
ColourPickerActivity::~ColourPickerActivity() {
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,7 @@ ConsoleView * ConsoleController::GetView()
|
||||
ConsoleController::~ConsoleController() {
|
||||
if(ui::Engine::Ref().GetWindow() == consoleView)
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
delete consoleModel;
|
||||
delete consoleView;
|
||||
}
|
||||
|
@ -144,7 +144,6 @@ void ConfirmPrompt::OnDraw()
|
||||
}
|
||||
|
||||
ConfirmPrompt::~ConfirmPrompt() {
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,6 @@ void ErrorMessage::OnDraw()
|
||||
}
|
||||
|
||||
ErrorMessage::~ErrorMessage() {
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,6 @@ void TextPrompt::OnDraw()
|
||||
}
|
||||
|
||||
TextPrompt::~TextPrompt() {
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -332,6 +332,5 @@ void FileBrowserActivity::OnDraw()
|
||||
|
||||
FileBrowserActivity::~FileBrowserActivity()
|
||||
{
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
}
|
||||
|
@ -51,8 +51,7 @@ public:
|
||||
{
|
||||
if(origBitmap)
|
||||
{
|
||||
if(bitmap)
|
||||
delete[] bitmap;
|
||||
delete[] bitmap;
|
||||
bitmap = new unsigned char[size.X*size.Y];
|
||||
if(size == origSize)
|
||||
std::copy(origBitmap, origBitmap+(origSize.X*origSize.Y), bitmap);
|
||||
@ -88,8 +87,7 @@ public:
|
||||
}
|
||||
virtual ~BitmapBrush()
|
||||
{
|
||||
if(origBitmap)
|
||||
delete[] origBitmap;
|
||||
delete[] origBitmap;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -18,8 +18,7 @@ protected:
|
||||
GenerateBitmap();
|
||||
if(!bitmap)
|
||||
return;
|
||||
if(outline)
|
||||
delete[] outline;
|
||||
delete[] outline;
|
||||
outline = new unsigned char[size.X*size.Y];
|
||||
for(int x = 0; x < size.X; x++)
|
||||
{
|
||||
@ -64,10 +63,8 @@ public:
|
||||
updateOutline();
|
||||
}
|
||||
virtual ~Brush() {
|
||||
if(bitmap)
|
||||
delete[] bitmap;
|
||||
if(outline)
|
||||
delete[] outline;
|
||||
delete[] bitmap;
|
||||
delete[] outline;
|
||||
}
|
||||
virtual void RenderRect(Renderer * ren, ui::Point position1, ui::Point position2);
|
||||
virtual void RenderLine(Renderer * ren, ui::Point position1, ui::Point position2);
|
||||
@ -75,8 +72,7 @@ public:
|
||||
virtual void RenderFill(Renderer * ren, ui::Point position);
|
||||
virtual void GenerateBitmap()
|
||||
{
|
||||
if(bitmap)
|
||||
delete[] bitmap;
|
||||
delete[] bitmap;
|
||||
bitmap = new unsigned char[size.X*size.Y];
|
||||
for(int x = 0; x < size.X; x++)
|
||||
{
|
||||
|
@ -14,8 +14,7 @@ public:
|
||||
}
|
||||
virtual void GenerateBitmap()
|
||||
{
|
||||
if(bitmap)
|
||||
delete[] bitmap;
|
||||
delete[] bitmap;
|
||||
bitmap = new unsigned char[size.X*size.Y];
|
||||
int rx = radius.X;
|
||||
int ry = radius.Y;
|
||||
|
@ -1223,8 +1223,7 @@ void GameController::OpenTags()
|
||||
{
|
||||
if(gameModel->GetSave() && gameModel->GetSave()->GetID())
|
||||
{
|
||||
if (tagsWindow)
|
||||
delete tagsWindow;
|
||||
delete tagsWindow;
|
||||
tagsWindow = new TagsController(new TagsCallback(this), gameModel->GetSave());
|
||||
ui::Engine::Ref().ShowWindow(tagsWindow->GetView());
|
||||
}
|
||||
|
@ -176,14 +176,10 @@ GameModel::~GameModel()
|
||||
}
|
||||
delete sim;
|
||||
delete ren;
|
||||
if(placeSave)
|
||||
delete placeSave;
|
||||
if(clipboard)
|
||||
delete clipboard;
|
||||
if(currentSave)
|
||||
delete currentSave;
|
||||
if(currentFile)
|
||||
delete currentFile;
|
||||
delete placeSave;
|
||||
delete clipboard;
|
||||
delete currentSave;
|
||||
delete currentFile;
|
||||
//if(activeTools)
|
||||
// delete[] activeTools;
|
||||
}
|
||||
@ -556,15 +552,13 @@ void GameModel::SetSave(SaveInfo * newSave)
|
||||
{
|
||||
if(currentSave != newSave)
|
||||
{
|
||||
if(currentSave)
|
||||
delete currentSave;
|
||||
delete currentSave;
|
||||
if(newSave == NULL)
|
||||
currentSave = NULL;
|
||||
else
|
||||
currentSave = new SaveInfo(*newSave);
|
||||
}
|
||||
if(currentFile)
|
||||
delete currentFile;
|
||||
delete currentFile;
|
||||
currentFile = NULL;
|
||||
|
||||
if(currentSave && currentSave->GetGameSave())
|
||||
@ -599,15 +593,13 @@ void GameModel::SetSaveFile(SaveFile * newSave)
|
||||
{
|
||||
if(currentFile != newSave)
|
||||
{
|
||||
if(currentFile)
|
||||
delete currentFile;
|
||||
delete currentFile;
|
||||
if(newSave == NULL)
|
||||
currentFile = NULL;
|
||||
else
|
||||
currentFile = new SaveFile(*newSave);
|
||||
}
|
||||
if (currentSave)
|
||||
delete currentSave;
|
||||
delete currentSave;
|
||||
currentSave = NULL;
|
||||
|
||||
if(newSave && newSave->GetGameSave())
|
||||
@ -907,8 +899,7 @@ void GameModel::SetPlaceSave(GameSave * save)
|
||||
{
|
||||
if(save != placeSave)
|
||||
{
|
||||
if(placeSave)
|
||||
delete placeSave;
|
||||
delete placeSave;
|
||||
if(save)
|
||||
placeSave = new GameSave(*save);
|
||||
else
|
||||
@ -919,8 +910,7 @@ void GameModel::SetPlaceSave(GameSave * save)
|
||||
|
||||
void GameModel::SetClipboard(GameSave * save)
|
||||
{
|
||||
if(clipboard)
|
||||
delete clipboard;
|
||||
delete clipboard;
|
||||
clipboard = save;
|
||||
}
|
||||
|
||||
|
@ -142,8 +142,7 @@ public:
|
||||
}
|
||||
virtual ~SplitButton()
|
||||
{
|
||||
if(splitActionCallback)
|
||||
delete splitActionCallback;
|
||||
delete splitActionCallback;
|
||||
}
|
||||
};
|
||||
|
||||
@ -460,8 +459,7 @@ GameView::~GameView()
|
||||
|
||||
}
|
||||
|
||||
if(placeSaveThumb)
|
||||
delete placeSaveThumb;
|
||||
delete placeSaveThumb;
|
||||
}
|
||||
|
||||
class GameView::MenuAction: public ui::ButtonAction
|
||||
@ -728,8 +726,7 @@ void GameView::NotifyToolListChanged(GameModel * sender)
|
||||
tempButton->SetActionCallback(new ToolAction(this, toolList[i]));
|
||||
|
||||
tempButton->Appearance.SetTexture(tempTexture);
|
||||
if(tempTexture)
|
||||
delete tempTexture;
|
||||
delete tempTexture;
|
||||
|
||||
tempButton->Appearance.BackgroundInactive = ui::Colour(toolList[i]->colRed, toolList[i]->colGreen, toolList[i]->colBlue);
|
||||
|
||||
@ -1867,8 +1864,7 @@ void GameView::NotifyLogChanged(GameModel * sender, string entry)
|
||||
|
||||
void GameView::NotifyPlaceSaveChanged(GameModel * sender)
|
||||
{
|
||||
if(placeSaveThumb)
|
||||
delete placeSaveThumb;
|
||||
delete placeSaveThumb;
|
||||
if(sender->GetPlaceSave())
|
||||
{
|
||||
placeSaveThumb = SaveRenderer::Ref().Render(sender->GetPlaceSave());
|
||||
|
@ -21,8 +21,7 @@ public:
|
||||
};
|
||||
virtual void GenerateBitmap()
|
||||
{
|
||||
if(bitmap)
|
||||
delete[] bitmap;
|
||||
delete[] bitmap;
|
||||
bitmap = new unsigned char[size.X*size.Y];
|
||||
int rx = radius.X;
|
||||
int ry = radius.Y;
|
||||
|
@ -37,8 +37,7 @@ namespace ui
|
||||
|
||||
void Appearance::SetTexture(VideoBuffer * texture)
|
||||
{
|
||||
if(this->texture)
|
||||
delete this->texture;
|
||||
delete this->texture;
|
||||
if(texture)
|
||||
this->texture = new VideoBuffer(texture);
|
||||
else
|
||||
@ -47,8 +46,7 @@ namespace ui
|
||||
|
||||
Appearance::~Appearance()
|
||||
{
|
||||
if(texture)
|
||||
delete texture;
|
||||
delete texture;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,10 +25,8 @@ AvatarButton::AvatarButton(Point position, Point size, std::string username):
|
||||
AvatarButton::~AvatarButton()
|
||||
{
|
||||
RequestBroker::Ref().DetachRequestListener(this);
|
||||
if(avatar)
|
||||
delete avatar;
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
delete avatar;
|
||||
delete actionCallback;
|
||||
}
|
||||
|
||||
void AvatarButton::Tick(float dt)
|
||||
@ -45,8 +43,7 @@ void AvatarButton::OnResponseReady(void * imagePtr, int identifier)
|
||||
VideoBuffer * image = (VideoBuffer*)imagePtr;
|
||||
if(image)
|
||||
{
|
||||
if(avatar)
|
||||
delete avatar;
|
||||
delete avatar;
|
||||
avatar = image;
|
||||
}
|
||||
}
|
||||
|
@ -219,15 +219,13 @@ void Button::DoAltAction()
|
||||
|
||||
void Button::SetActionCallback(ButtonAction * action)
|
||||
{
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
delete actionCallback;
|
||||
actionCallback = action;
|
||||
}
|
||||
|
||||
Button::~Button()
|
||||
{
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
delete actionCallback;
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
||||
|
@ -96,13 +96,11 @@ void Checkbox::Draw(const Point& screenPos)
|
||||
|
||||
void Checkbox::SetActionCallback(CheckboxAction * action)
|
||||
{
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
delete actionCallback;
|
||||
actionCallback = action;
|
||||
}
|
||||
|
||||
Checkbox::~Checkbox() {
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
delete actionCallback;
|
||||
}
|
||||
|
||||
|
@ -239,6 +239,5 @@ void Component::OnMouseWheelInside(int localx, int localy, int d)
|
||||
|
||||
Component::~Component()
|
||||
{
|
||||
if(menu)
|
||||
delete menu;
|
||||
delete menu;
|
||||
}
|
||||
|
@ -190,8 +190,7 @@ void DropDown::OnMouseLeave(int x, int y)
|
||||
|
||||
|
||||
DropDown::~DropDown() {
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
||||
|
@ -39,16 +39,14 @@ Engine::Engine():
|
||||
|
||||
Engine::~Engine()
|
||||
{
|
||||
if(state_ != NULL)
|
||||
delete state_;
|
||||
delete state_;
|
||||
//Dispose of any Windows.
|
||||
while(!windows.empty())
|
||||
{
|
||||
delete windows.top();
|
||||
windows.pop();
|
||||
}
|
||||
if (lastBuffer)
|
||||
free(lastBuffer);
|
||||
free(lastBuffer);
|
||||
}
|
||||
|
||||
void Engine::Begin(int width, int height)
|
||||
|
@ -46,8 +46,7 @@ Panel::~Panel()
|
||||
{
|
||||
for(unsigned i = 0; i < children.size(); ++i)
|
||||
{
|
||||
if( children[i] )
|
||||
delete children[i];
|
||||
delete children[i];
|
||||
}
|
||||
#ifdef OGLI
|
||||
glDeleteTextures(1, &myVidTex);
|
||||
|
@ -118,14 +118,10 @@ SaveButton::~SaveButton()
|
||||
{
|
||||
RequestBroker::Ref().DetachRequestListener(this);
|
||||
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
if(save)
|
||||
delete save;
|
||||
if(file)
|
||||
delete file;
|
||||
delete thumbnail;
|
||||
delete actionCallback;
|
||||
delete save;
|
||||
delete file;
|
||||
}
|
||||
|
||||
void SaveButton::OnResponseReady(void * imagePtr, int identifier)
|
||||
@ -133,8 +129,7 @@ void SaveButton::OnResponseReady(void * imagePtr, int identifier)
|
||||
VideoBuffer * image = (VideoBuffer*)imagePtr;
|
||||
if(image)
|
||||
{
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
delete thumbnail;
|
||||
thumbnail = image;
|
||||
waitingForThumb = false;
|
||||
}
|
||||
|
@ -68,8 +68,7 @@ void Slider::SetColour(Colour col1, Colour col2)
|
||||
{
|
||||
pixel pix[2] = {(pixel)PIXRGB(col1.Red, col1.Green, col1.Blue), (pixel)PIXRGB(col2.Red, col2.Green, col2.Blue)};
|
||||
float fl[2] = {0.0f, 1.0f};
|
||||
if(bgGradient)
|
||||
free(bgGradient);
|
||||
free(bgGradient);
|
||||
this->col1 = col1;
|
||||
this->col2 = col2;
|
||||
bgGradient = (unsigned char*)Graphics::GenerateGradient(pix, fl, 2, Size.X-7);
|
||||
|
@ -35,8 +35,7 @@ Textbox::Textbox(Point position, Point size, std::string textboxText, std::strin
|
||||
|
||||
Textbox::~Textbox()
|
||||
{
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
delete actionCallback;
|
||||
}
|
||||
|
||||
void Textbox::SetHidden(bool hidden)
|
||||
@ -566,8 +565,7 @@ Textbox::Textbox(Point position, Point size, std::string textboxText):
|
||||
|
||||
Textbox::~Textbox()
|
||||
{
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
delete actionCallback;
|
||||
}
|
||||
|
||||
void Textbox::TextPosition()
|
||||
|
@ -176,8 +176,7 @@ void LocalBrowserController::Exit()
|
||||
LocalBrowserController::~LocalBrowserController() {
|
||||
if(ui::Engine::Ref().GetWindow() == browserView)
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
delete browserModel;
|
||||
delete browserView;
|
||||
}
|
||||
|
@ -50,8 +50,7 @@ SaveFile * LocalBrowserModel::GetSave()
|
||||
|
||||
void LocalBrowserModel::SetSave(SaveFile * newStamp)
|
||||
{
|
||||
if(stamp)
|
||||
delete stamp;
|
||||
delete stamp;
|
||||
stamp = new SaveFile(*newStamp);
|
||||
}
|
||||
|
||||
@ -141,7 +140,6 @@ void LocalBrowserModel::notifySelectedChanged()
|
||||
}
|
||||
|
||||
LocalBrowserModel::~LocalBrowserModel() {
|
||||
if(stamp)
|
||||
delete stamp;
|
||||
delete stamp;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,6 @@ OptionsController::~OptionsController() {
|
||||
}
|
||||
delete model;
|
||||
delete view;
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,6 @@ PreviewController::~PreviewController() {
|
||||
Client::Ref().RemoveListener(this);
|
||||
delete previewModel;
|
||||
delete previewView;
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -139,14 +139,12 @@ void PreviewModel::OnResponseReady(void * object, int identifier)
|
||||
{
|
||||
if (identifier == 1)
|
||||
{
|
||||
if (saveData)
|
||||
delete saveData;
|
||||
delete saveData;
|
||||
saveData = (std::vector<unsigned char>*)object;
|
||||
}
|
||||
if (identifier == 2)
|
||||
{
|
||||
if (save)
|
||||
delete save;
|
||||
delete save;
|
||||
save = (SaveInfo*)object;
|
||||
}
|
||||
if (identifier == 3)
|
||||
@ -243,10 +241,8 @@ void PreviewModel::AddObserver(PreviewView * observer)
|
||||
PreviewModel::~PreviewModel()
|
||||
{
|
||||
RequestBroker::Ref().DetachRequestListener(this);
|
||||
if (save)
|
||||
delete save;
|
||||
if (saveData)
|
||||
delete saveData;
|
||||
delete save;
|
||||
delete saveData;
|
||||
if (saveComments)
|
||||
{
|
||||
for (size_t i = 0; i < saveComments->size(); i++)
|
||||
|
@ -408,8 +408,7 @@ void PreviewView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, b
|
||||
void PreviewView::NotifySaveChanged(PreviewModel * sender)
|
||||
{
|
||||
SaveInfo * save = sender->GetSave();
|
||||
if(savePreview)
|
||||
delete savePreview;
|
||||
delete savePreview;
|
||||
savePreview = NULL;
|
||||
if(save)
|
||||
{
|
||||
@ -624,7 +623,6 @@ PreviewView::~PreviewView()
|
||||
RemoveComponent(submitCommentButton);
|
||||
delete submitCommentButton;
|
||||
}
|
||||
if(savePreview)
|
||||
delete savePreview;
|
||||
delete savePreview;
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,7 @@ RenderController::~RenderController() {
|
||||
{
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
}
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
delete renderModel;
|
||||
delete renderView;
|
||||
}
|
||||
|
@ -135,16 +135,13 @@ void LocalSaveActivity::OnDraw()
|
||||
|
||||
void LocalSaveActivity::OnResponseReady(void * imagePtr, int identifier)
|
||||
{
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
delete thumbnail;
|
||||
thumbnail = (VideoBuffer*)imagePtr;
|
||||
}
|
||||
|
||||
LocalSaveActivity::~LocalSaveActivity()
|
||||
{
|
||||
RequestBroker::Ref().DetachRequestListener(this);
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete thumbnail;
|
||||
delete callback;
|
||||
}
|
||||
|
@ -358,18 +358,14 @@ void ServerSaveActivity::OnDraw()
|
||||
|
||||
void ServerSaveActivity::OnResponseReady(void * imagePtr, int identifier)
|
||||
{
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
delete thumbnail;
|
||||
thumbnail = (VideoBuffer *)imagePtr;
|
||||
}
|
||||
|
||||
ServerSaveActivity::~ServerSaveActivity()
|
||||
{
|
||||
RequestBroker::Ref().DetachRequestListener(this);
|
||||
if(saveUploadTask)
|
||||
delete saveUploadTask;
|
||||
if(callback)
|
||||
delete callback;
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
delete saveUploadTask;
|
||||
delete callback;
|
||||
delete thumbnail;
|
||||
}
|
||||
|
@ -99,8 +99,7 @@ void SearchController::Exit()
|
||||
|
||||
SearchController::~SearchController()
|
||||
{
|
||||
if(activePreview)
|
||||
delete activePreview;
|
||||
delete activePreview;
|
||||
if(ui::Engine::Ref().GetWindow() == searchView)
|
||||
{
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
@ -204,8 +203,7 @@ void SearchController::InstantOpen(bool instant)
|
||||
|
||||
void SearchController::OpenSave(int saveID)
|
||||
{
|
||||
if(activePreview)
|
||||
delete activePreview;
|
||||
delete activePreview;
|
||||
Graphics * g = ui::Engine::Ref().g;
|
||||
g->fillrect(XRES/3, WINDOWH-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable
|
||||
activePreview = new PreviewController(saveID, instantOpen, new OpenCallback(this));
|
||||
@ -214,8 +212,7 @@ void SearchController::OpenSave(int saveID)
|
||||
|
||||
void SearchController::OpenSave(int saveID, int saveDate)
|
||||
{
|
||||
if(activePreview)
|
||||
delete activePreview;
|
||||
delete activePreview;
|
||||
Graphics * g = ui::Engine::Ref().g;
|
||||
g->fillrect(XRES/3, WINDOWH-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable
|
||||
activePreview = new PreviewController(saveID, saveDate, instantOpen, new OpenCallback(this));
|
||||
|
@ -278,6 +278,5 @@ void SearchModel::notifySelectedChanged()
|
||||
|
||||
SearchModel::~SearchModel()
|
||||
{
|
||||
if (loadedSave)
|
||||
delete loadedSave;
|
||||
delete loadedSave;
|
||||
}
|
||||
|
@ -68,6 +68,5 @@ void Thumbnail::Resize(ui::Point newSize)
|
||||
|
||||
Thumbnail::~Thumbnail()
|
||||
{
|
||||
if(Data)
|
||||
delete[] Data;
|
||||
delete[] Data;
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ TagsController::~TagsController() {
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
delete tagsModel;
|
||||
delete tagsView;
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,7 @@ private:
|
||||
data = http_async_req_stop(request, &status, &dataLength);
|
||||
if (status!=200)
|
||||
{
|
||||
if (data)
|
||||
free(data);
|
||||
free(data);
|
||||
errorStream << "Server responded with Status " << status;
|
||||
notifyError("Could not download update");
|
||||
return false;
|
||||
|
@ -1944,10 +1944,10 @@ int luatpt_getscript(lua_State* l)
|
||||
}
|
||||
|
||||
fin:
|
||||
if(filedata) free(filedata);
|
||||
if(fileuri) delete[] fileuri;
|
||||
if(filename) delete[] filename;
|
||||
if(luacommand) delete[] luacommand;
|
||||
free(filedata);
|
||||
delete[] fileuri;
|
||||
delete[] filename;
|
||||
delete[] luacommand;
|
||||
luacommand = NULL;
|
||||
|
||||
if(lastError)
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
}
|
||||
~CoordStack()
|
||||
{
|
||||
if (stack) free(stack);
|
||||
free(stack);
|
||||
}
|
||||
void push(int x, int y)
|
||||
{
|
||||
|
@ -140,8 +140,7 @@ VideoBuffer * SaveRenderer::Render(GameSave * save, bool decorations, bool fire)
|
||||
src+=WINDOWW;
|
||||
}
|
||||
tempThumb = new VideoBuffer(pData, width*CELL, height*CELL);
|
||||
if(pData)
|
||||
free(pData);
|
||||
free(pData);
|
||||
#endif
|
||||
}
|
||||
if(doCollapse)
|
||||
|
Loading…
Reference in New Issue
Block a user