Compare commits

...
23 Commits
Author SHA1 Message Date
isanae 41249036e5 Merge pull request #1194 from isanae/die-after-dump
Die after dumping
2020-08-13 14:42:19 -04:00
isanae d69289e081 always call the previous terminate handler, which should abort
without it, execution just resumes and dumps are created endlessly
2020-08-13 14:40:35 -04:00
isanae 0adf8a9f1b Merge pull request #1182 from AnyOldName3/dont-speak-ill-of-the-dead
Don't use reference as class member
2020-08-07 22:45:51 -04:00
AnyOldName3 05d03eec68 Don't use reference as class member
This particular QString was only ever constructed from a temporary,
so it was literally never going to work. We only hadn't noticed this
earlier as no one had tried using the mod repository bridge from a
plugin before (which is fairly bad given that three people have
theoretically tested it while working on its Python bindings in the
past).
2020-08-08 00:17:14 +01:00
isanae 592fa73104 Merge pull request #1176 from isanae/2.3.1-fixes
2.3.1 fixes
2020-08-01 11:11:41 -04:00
isanae 64ba6cae1e revert font scaling:
- users report low quality splash screen
 - sticking with qt's default is better in the long run
 - can still use the environment variable

revert network timer:
 - users report error in log every second
 - was a blind fix anyway, can't reliably reproduce it
2020-08-01 11:03:09 -04:00
isanae f71accc1ad bump to 2.3.1 2020-07-31 11:09:20 -04:00
isanae 44332c778d possible fix for "Network access is disabled"
start a timer and change NotAccessible back to UnknownAccessibility
2020-07-31 11:08:32 -04:00
isanae 6a1d57fe0c fixed bad font scaling 2020-07-31 10:01:00 -04:00
isanae 777229f28f added startSafeThread() to get core dumps for threads other than the main thread
added terminate handler
2020-07-31 09:56:19 -04:00
isanae 2eeaa0e31a fixed warning when trying to get the file type of files without extensions 2020-07-31 09:17:22 -04:00
Al 9d3281fd58 Update game-support-request.md 2020-07-29 16:59:32 +02:00
Al 1a468d66db Update game-support-request.md 2020-07-29 16:58:18 +02:00
Al 19fe01b60d Update issue templates 2020-07-29 16:57:31 +02:00
Al b6fac68b32 Update game-support-request.md 2020-07-29 16:53:57 +02:00
Al 50d883079e Update game-support-request.md 2020-07-29 16:53:22 +02:00
Al e379610805 Update game-support-request.md 2020-07-29 16:52:27 +02:00
Al 6dc736ca37 Update game-support-request.md 2020-07-29 16:50:00 +02:00
Al 7791ea0bd5 Create game-support-request.md 2020-07-29 16:47:43 +02:00
isanae e34a9e7315 Merge pull request #1172 from isanae/remove-prerelease
Chang release type to 0
2020-07-28 20:15:42 -04:00
isanae 4d546ea262 changed release type to 0 2020-07-28 20:15:12 -04:00
isanae 2ca7c1c9ea Merge pull request #1171 from isanae/bump-2.3
Bump to 2.3
2020-07-28 18:35:38 -04:00
isanae 4b0ba5c579 bumped to 2.3 2020-07-28 18:33:55 -04:00
9 changed files with 95 additions and 18 deletions
@@ -0,0 +1,27 @@
---
name: Game support Request
about: Request support for a new game
title: Add support for game [GAME NAME]
labels: 'additional games support, Feature Request, area: mo2 game plugins'
assignees: ''
---
**This template is useful to add basic support using https://github.com/ModOrganizer2/modorganizer-basic_games.**
**If you are vaguely familiar with programming you can try following the instructions on that link to get something working yourself. If you have trouble with that please fill in this template.**
**Please provide the following information for the game (remove the optional lines you do not use):**
- **Name:** Name of the game
- **Short name:** Name of the game in Nexus URL (e.g. skyrimse for Skyrim SE).
- **Nexus ID [optional]:** ID of the game on Nexus (you can usually find this in Nexus URL).
- **Executable:** Name of the main executable for the game (relative to the game folder).
- **Launcher [optional]:** Name of the game launcher (relative to the game folder).
- **Data path:** Path to the data folder of the game (relative to the game folder).
- **Documents path:** Path to folder containing INI files, etc., for the game (usually under "My Games", or the game folder itself).
- **Saves directory [optional]:** Path to the folder containing save games (this default to the path above).
- **Save extension [optional]:** Extension of the saves
- **Steam ID [optional]:** ID of the game on Steam (if the game is on Steam).
**Provide additional details regarding the game that could be required for the plugin.**
+2 -1
View File
@@ -1,6 +1,7 @@
#ifndef ENV_ENVFS_H
#define ENV_ENVFS_H
#include "thread_utils.h"
#include <thread>
namespace env
@@ -125,7 +126,7 @@ private:
ThreadInfo()
: busy(true), ready(false), stop(false)
{
thread = std::thread([&]{ run(); });
thread = MOShared::startSafeThread([&]{ run(); });
}
~ThreadInfo()
+1 -1
View File
@@ -40,7 +40,7 @@ const QString& directoryFileType()
const QString& cachedFileTypeNoExtension()
{
static const QString name = [] {
const DWORD flags = SHGFI_TYPENAME;
const DWORD flags = SHGFI_TYPENAME | SHGFI_USEFILEATTRIBUTES;
SHFILEINFOW sfi = {};
// dummy filename with no extension
+2 -1
View File
@@ -1,4 +1,5 @@
#include "iconfetcher.h"
#include "thread_utils.h"
#include "shared/util.h"
void IconFetcher::Waiter::wait()
@@ -25,7 +26,7 @@ IconFetcher::IconFetcher()
m_quickCache.file = getPixmapIcon(QFileIconProvider::File);
m_quickCache.directory = getPixmapIcon(QFileIconProvider::Folder);
m_thread = std::thread([&]{ threadFun(); });
m_thread = MOShared::startSafeThread([&]{ threadFun(); });
}
IconFetcher::~IconFetcher()
+33 -4
View File
@@ -127,9 +127,10 @@ bool bootstrap()
return true;
}
LPTOP_LEVEL_EXCEPTION_FILTER prevUnhandledExceptionFilter = nullptr;
thread_local LPTOP_LEVEL_EXCEPTION_FILTER prevUnhandledExceptionFilter = nullptr;
thread_local std::terminate_handler prevTerminateHandler = nullptr;
static LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *exceptionPtrs)
LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *exceptionPtrs)
{
const std::wstring& dumpPath = OrganizerCore::crashDumpsPath();
int dumpRes =
@@ -139,12 +140,39 @@ static LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *except
else
log::error("ModOrganizer has crashed, CreateMiniDump failed ({}, error {}).", dumpRes, GetLastError());
if (prevUnhandledExceptionFilter)
if (prevUnhandledExceptionFilter && exceptionPtrs)
return prevUnhandledExceptionFilter(exceptionPtrs);
else
return EXCEPTION_CONTINUE_SEARCH;
}
void terminateHandler() noexcept
{
__try
{
// force an exception to get a valid stack trace for this thread
*(int*)0 = 42;
}
__except
(
MyUnhandledExceptionFilter(GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER
)
{
}
if (prevTerminateHandler) {
prevTerminateHandler();
} else {
std::abort();
}
}
void setUnhandledExceptionHandler()
{
prevUnhandledExceptionFilter = SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
prevTerminateHandler = std::set_terminate(terminateHandler);
}
// Parses the first parseArgCount arguments of the current process command line and returns
// them in parsedArgs, the rest of the command line is returned untouched.
LPCWSTR UntouchedCommandLineArguments(int parseArgCount, std::vector<std::wstring>& parsedArgs)
@@ -171,6 +199,7 @@ LPCWSTR UntouchedCommandLineArguments(int parseArgCount, std::vector<std::wstrin
return cmd;
}
static int SpawnWaitProcess(LPCWSTR workingDirectory, LPCWSTR commandLine) {
PROCESS_INFORMATION pi{ 0 };
STARTUPINFO si{ 0 };
@@ -947,7 +976,7 @@ int main(int argc, char *argv[])
application.setProperty("dataPath", dataPath);
// initialize dump collection only after "dataPath" since the crashes are stored under it
prevUnhandledExceptionFilter = SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
setUnhandledExceptionHandler();
const auto logFile =
qApp->property("dataPath").toString() + "/logs/mo_interface.log";
+4 -4
View File
@@ -221,7 +221,7 @@ void OrganizerCore::updateExecutablesList()
void OrganizerCore::updateModInfoFromDisc() {
ModInfo::updateFromDisc(
m_Settings.paths().mods(), &m_DirectoryStructure,
m_PluginContainer, m_Settings.interface().displayForeign(),
m_PluginContainer, m_Settings.interface().displayForeign(),
m_Settings.refreshThreadCount(), managedGame());
}
@@ -371,7 +371,7 @@ void OrganizerCore::downloadRequestedNXM(const QString &url)
}
}
void OrganizerCore::userInterfaceInitialized()
void OrganizerCore::userInterfaceInitialized()
{
m_UserInterfaceInitialized(m_UserInterface->mainWindow());
}
@@ -1139,7 +1139,7 @@ void OrganizerCore::refreshModList(bool saveChanges)
ModInfo::updateFromDisc(
m_Settings.paths().mods(), &m_DirectoryStructure,
m_PluginContainer, m_Settings.interface().displayForeign(),
m_PluginContainer, m_Settings.interface().displayForeign(),
m_Settings.refreshThreadCount(), managedGame());
m_CurrentProfile->refreshModStatus();
@@ -1473,7 +1473,7 @@ void OrganizerCore::directory_refreshed()
m_StructureDeleter.join();
}
m_StructureDeleter = std::thread([=]{
m_StructureDeleter = MOShared::startSafeThread([=]{
log::debug("structure deleter thread start");
delete newStructure;
log::debug("structure deleter thread done");
+1 -1
View File
@@ -65,7 +65,7 @@ private:
OrganizerCore *m_Proxied;
PluginContainer *m_PluginContainer;
const QString &m_PluginName;
QString m_PluginName;
};
+22 -3
View File
@@ -1,12 +1,31 @@
#ifndef MO2_THREAD_UTILS_H
#define MO2_THREAD_UTILS_H
#include <log.h>
#include <functional>
#include <mutex>
#include <thread>
// in main.cpp
void setUnhandledExceptionHandler();
LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *exceptionPtrs);
namespace MOShared {
// starts an std::thread with an unhandled exception handler for core dumps
// and a top-level catch
//
template <class F>
std::thread startSafeThread(F&& f)
{
return std::thread([f=std::forward<F>(f)] {
setUnhandledExceptionHandler();
f();
});
}
/**
* Class that can be used to perform thread-safe memoization.
*
@@ -26,7 +45,7 @@ struct MemoizedLocked {
template <class Callable>
MemoizedLocked(Callable &&callable, T value = {}) :
m_Fn{ std::forward<Callable>(callable) }, m_Value{ std::move(value) } { }
template <class... Args>
T& value(Args&&... args) const {
if (m_NeedUpdating) {
@@ -66,7 +85,7 @@ private:
*
*/
template <class It, class Callable>
void parallelMap(It begin, It end, Callable callable, std::size_t nThreads)
void parallelMap(It begin, It end, Callable callable, std::size_t nThreads)
{
std::mutex m;
std::vector<std::thread> threads(nThreads);
@@ -75,7 +94,7 @@ void parallelMap(It begin, It end, Callable callable, std::size_t nThreads)
// - The mutex is only used to fetch/increment the iterator.
// - The callable is copied in each thread to avoid conflicts.
for (auto &thread: threads) {
thread = std::thread([&m, &begin, end, callable]() {
thread = startSafeThread([&m, &begin, end, callable]() {
while (true) {
decltype(begin) it;
{
+3 -3
View File
@@ -3,14 +3,14 @@
// If VS_FF_PRERELEASE is not set, MO labels the build as a release and uses VER_FILEVERSION to determine version number.
// Otherwise, if letters are used in VER_FILEVERSION_STR, uses the full MOBase::VersionInfo parser
// Otherwise, uses the numbers from VER_FILEVERSION and sets the release type as pre-alpha
#define VER_FILEVERSION 2,3,0
#define VER_FILEVERSION_STR "2.3.0rc2\0"
#define VER_FILEVERSION 2,3,1
#define VER_FILEVERSION_STR "2.3.1\0"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_FILEVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS VS_FF_PRERELEASE
FILEFLAGS (0)
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE (0)