Skip to content

Commit c6a1b97

Browse files
Merge pull request qbittorrent#18456 from sledgehammer999/win_shorcut_cwd
Fix PDB loading for valid stacktraces
2 parents c58fb92 + b61c7b7 commit c6a1b97

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

dist/windows/installer.nsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Section $(inst_qbt_req) ;"qBittorrent (required)"
3535
SetOutPath "$INSTDIR\translations"
3636
; Put files there
3737
File /r "translations\qt*.qm"
38+
; Restore output path because it affects `CreateShortCut`. It affects the "Start in" field.
39+
SetOutPath $INSTDIR
3840

3941
; Write the installation path into the registry
4042
WriteRegStr HKLM "Software\qBittorrent" "InstallLocation" "$INSTDIR"

src/app/main.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,17 @@ int main(int argc, char *argv[])
118118
// Create Application
119119
auto app = std::make_unique<Application>(argc, argv);
120120

121+
#ifdef Q_OS_WIN
122+
// QCoreApplication::applicationDirPath() needs an Application object instantiated first
123+
// Let's hope that there won't be a crash before this line
124+
const char *envName = "_NT_SYMBOL_PATH";
125+
const QString envValue = qEnvironmentVariable(envName);
126+
if (envValue.isEmpty())
127+
qputenv(envName, Application::applicationDirPath().toLocal8Bit());
128+
else
129+
qputenv(envName, u"%1;%2"_qs.arg(envValue, Application::applicationDirPath()).toLocal8Bit());
130+
#endif
131+
121132
const QBtCommandLineParameters params = app->commandLineArgs();
122133
if (!params.unknownParameter.isEmpty())
123134
{

0 commit comments

Comments
 (0)