Skip to content

Commit

Permalink
Segfault fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jackoalan committed Nov 17, 2019
1 parent 79ec379 commit cfea90e
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 46 deletions.
9 changes: 9 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
UseTab: Never
IndentWidth: 4
BreakBeforeBraces: Allman
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
ColumnLimit: 0
DerivePointerAlignment: false
PointerAlignment: Left
AccessModifierOffset: -4
54 changes: 26 additions & 28 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -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 changes: 1 addition & 1 deletion externals/LibCommon
16 changes: 8 additions & 8 deletions src/Core/Tweaks/CTweakManager.cpp
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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);
}
}
}

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Editor/CProgressDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );

Expand Down Expand Up @@ -63,7 +63,7 @@ void CProgressDialog::closeEvent(QCloseEvent *pEvent)
{
pEvent->accept();

#if WIN32
#ifdef WIN32
if (mpTaskbarProgress)
{
mpTaskbarProgress->reset();
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Editor/CProgressDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <QFuture>
#include <QFutureWatcher>

#if WIN32
#ifdef WIN32
#include <QtWinExtras/QWinTaskbarButton>
#include <QtWinExtras/QWinTaskbarProgress>
#endif
Expand All @@ -28,7 +28,7 @@ class CProgressDialog : public IProgressNotifierUI
bool mFinished;
bool mCanceled;

#if WIN32
#ifdef WIN32
QWinTaskbarProgress *mpTaskbarProgress;
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/Editor/ResourceBrowser/CResourceTableContextMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
6 changes: 4 additions & 2 deletions src/Editor/WorldEditor/CWorldEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit cfea90e

Please sign in to comment.