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

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

2
externals/LibCommon vendored

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

View File

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

View File

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

View File

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

View File

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

View File

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