Segfault fixes

This commit is contained in:
Jack Andersen 2019-11-16 15:24:46 -10:00
parent 79ec379c66
commit cfea90e9d2
8 changed files with 55 additions and 46 deletions

9
.clang-format Normal file
View File

@ -0,0 +1,9 @@
UseTab: Never
IndentWidth: 4
BreakBeforeBraces: Allman
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
ColumnLimit: 0
DerivePointerAlignment: false
PointerAlignment: Left
AccessModifierOffset: -4

View File

@ -1,30 +1,28 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-DCMAKE_PREFIX_PATH=C:/Qt/5.12.3/msvc2017_64/lib/cmake/Qt5",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-DCMAKE_PREFIX_PATH=C:/Qt/5.12.3/msvc2017_64/lib/cmake/Qt5",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
}
]
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-DCMAKE_PREFIX_PATH=C:/Qt/5.12.6/msvc2017_64/lib/cmake/Qt5",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": []
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-DCMAKE_PREFIX_PATH=C:/Qt/5.12.6/msvc2017_64/lib/cmake/Qt5",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": []
}
]
}

2
externals/LibCommon vendored

@ -1 +1 @@
Subproject commit 8393432003b8e634cba4e89c27635fec0ae43a6f
Subproject commit 9ee4e6ac6cb1fa6b7db45099ae37026db2d2c49c

View File

@ -1,8 +1,8 @@
#include "CTweakManager.h"
#include "Core/GameProject/CGameProject.h"
#include "Core/GameProject/CResourceIterator.h"
#include "Core/Tweaks/CTweakLoader.h"
#include "Core/Tweaks/CTweakCooker.h"
#include "Core/Tweaks/CTweakLoader.h"
CTweakManager::CTweakManager(CGameProject* pInProject)
: mpProject(pInProject)
@ -16,16 +16,18 @@ CTweakManager::~CTweakManager()
void CTweakManager::LoadTweaks()
{
ASSERT( mTweakObjects.empty() );
ASSERT(mTweakObjects.empty());
// MP1 - Load all tweak assets into memory
if (mpProject->Game() <= EGame::Prime)
{
for (TResourceIterator<EResourceType::Tweaks> It(mpProject->ResourceStore()); It; ++It)
{
CTweakData* pTweaks = (CTweakData*) It->Load();
pTweaks->Lock();
mTweakObjects.push_back(pTweaks);
if (CTweakData* pTweaks = (CTweakData*)It->Load())
{
pTweaks->Lock();
mTweakObjects.push_back(pTweaks);
}
}
}
@ -40,9 +42,7 @@ void CTweakManager::LoadTweaks()
{
// For Wii builds, there is another game-dependent subfolder.
EGame Game = mpProject->Game();
TString GameName = (Game == EGame::Prime ? "MP1" :
Game == EGame::Echoes ? "MP2" :
"MP3");
TString GameName = (Game == EGame::Prime ? "MP1" : Game == EGame::Echoes ? "MP2" : "MP3");
mStandardFilePath = mpProject->DiscFilesystemRoot(false) / GameName / "Standard.ntwk";
// MP3 might actually be FrontEnd

View File

@ -16,7 +16,7 @@ CProgressDialog::CProgressDialog(QString OperationName, bool UseBusyIndicator, b
mpUI->ProgressBar->setMaximum(UseBusyIndicator ? 0 : 10000);
setWindowTitle(OperationName);
#if WIN32
#ifdef WIN32
QWinTaskbarButton *pButton = new QWinTaskbarButton(this);
QWindow *pWindow = UICommon::FindWidgetWindowHandle( parentWidget() );
@ -63,7 +63,7 @@ void CProgressDialog::closeEvent(QCloseEvent *pEvent)
{
pEvent->accept();
#if WIN32
#ifdef WIN32
if (mpTaskbarProgress)
{
mpTaskbarProgress->reset();
@ -108,7 +108,7 @@ void CProgressDialog::UpdateUI(const QString& rkTaskDesc, const QString& rkStepD
int ProgressValue = 10000 * ProgressPercent;
mpUI->ProgressBar->setValue(ProgressValue);
#if WIN32
#ifdef WIN32
if (mpTaskbarProgress)
mpTaskbarProgress->setValue(ProgressValue);
#endif

View File

@ -10,7 +10,7 @@
#include <QFuture>
#include <QFutureWatcher>
#if WIN32
#ifdef WIN32
#include <QtWinExtras/QWinTaskbarButton>
#include <QtWinExtras/QWinTaskbarProgress>
#endif
@ -28,7 +28,7 @@ class CProgressDialog : public IProgressNotifierUI
bool mFinished;
bool mCanceled;
#if WIN32
#ifdef WIN32
QWinTaskbarProgress *mpTaskbarProgress;
#endif

View File

@ -26,9 +26,9 @@ void CResourceTableContextMenu::InitMenu()
if (mpClickedEntry)
{
#if WIN32
#ifdef WIN32
const QString kOpenInExplorerString = "Show in Explorer";
#elif __APPLE__
#elif defined(__APPLE__)
const QString kOpenInExplorerString = "Show in Finder";
#else
const QString kOpenInExplorerString = "Show in file manager";

View File

@ -222,7 +222,8 @@ CWorldEditor::~CWorldEditor()
mScene.ClearScene();
mpArea = nullptr;
mpWorld = nullptr;
gpResourceStore->DestroyUnreferencedResources(); // this should destroy the area!
if (gpResourceStore)
gpResourceStore->DestroyUnreferencedResources(); // this should destroy the area!
delete mpScriptSidebar; // For some reason WCreateTab filters an event during the viewport's destructor
delete ui;
@ -244,7 +245,8 @@ bool CWorldEditor::CloseWorld()
mpArea = nullptr;
mpWorld = nullptr;
gpResourceStore->DestroyUnreferencedResources(); // this should destroy the area!
if (gpResourceStore)
gpResourceStore->DestroyUnreferencedResources(); // this should destroy the area!
UpdateWindowTitle();
ui->ActionSave->setEnabled(false);