mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 17:09:34 -05:00
Fixed a possible crash at startup.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5311 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
cda4adbf5b
commit
47d652b4ec
@ -57,12 +57,13 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication *dummyApp = new QApplication(argc, argv); // memory leak in case of an error in main
|
|
||||||
|
|
||||||
#ifdef WINDOWS_SYS
|
#ifdef WINDOWS_SYS
|
||||||
|
{
|
||||||
/* Set the current directory to the application dir,
|
/* Set the current directory to the application dir,
|
||||||
because the start dir with autostart from the registry run key is not the exe dir */
|
because the start dir with autostart from the registry run key is not the exe dir */
|
||||||
|
QApplication app(argc, argv);
|
||||||
QDir::setCurrent(QCoreApplication::applicationDirPath());
|
QDir::setCurrent(QCoreApplication::applicationDirPath());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QStringList args = char_array_to_stringlist(argv+1, argc-1);
|
QStringList args = char_array_to_stringlist(argv+1, argc-1);
|
||||||
@ -75,15 +76,16 @@ int main(int argc, char *argv[])
|
|||||||
createRsIface(*notify);
|
createRsIface(*notify);
|
||||||
createRsControl(*rsiface, *notify);
|
createRsControl(*rsiface, *notify);
|
||||||
|
|
||||||
/* Translate into the desired language */
|
|
||||||
LanguageSupport::translate(LanguageSupport::defaultLanguageCode());
|
|
||||||
|
|
||||||
/* RetroShare Core Objects */
|
/* RetroShare Core Objects */
|
||||||
RsInit::InitRsConfig();
|
RsInit::InitRsConfig();
|
||||||
int initResult = RsInit::InitRetroShare(argc, argv);
|
int initResult = RsInit::InitRetroShare(argc, argv);
|
||||||
|
|
||||||
if(initResult == RS_INIT_NO_KEYRING) // happens when we already have accounts, but no pgp key. This is when switching to the openpgp-sdk version.
|
if(initResult == RS_INIT_NO_KEYRING) // happens when we already have accounts, but no pgp key. This is when switching to the openpgp-sdk version.
|
||||||
{
|
{
|
||||||
|
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
||||||
|
/* Translate into the desired language */
|
||||||
|
LanguageSupport::translate(LanguageSupport::defaultLanguageCode());
|
||||||
|
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText(QObject::tr("This version of RetroShare is using OpenPGP-SDK. As a side effect, it's not using the system shared PGP keyring, but has it's own keyring shared by all RetroShare instances. <br><br>You do not appear to have such a keyring, although GPG keys are mentionned by existing RetroShare accounts, probably because you just changed to this new version of the software."));
|
msgBox.setText(QObject::tr("This version of RetroShare is using OpenPGP-SDK. As a side effect, it's not using the system shared PGP keyring, but has it's own keyring shared by all RetroShare instances. <br><br>You do not appear to have such a keyring, although GPG keys are mentionned by existing RetroShare accounts, probably because you just changed to this new version of the software."));
|
||||||
msgBox.setInformativeText(QObject::tr("Choose between:<br><ul><li><b>Ok</b> to copy the existing keyring from gnupg (safest bet), or </li><li><b>Close without saving</b> to start fresh with an empty keyring (you will be asked to create a new PGP key to work with RetroShare, or import a previously saved pgp keypair). </li><li><b>Cancel</b> to quit and forge a keyring by yourself (needs some PGP skills)</li></ul>"));
|
msgBox.setInformativeText(QObject::tr("Choose between:<br><ul><li><b>Ok</b> to copy the existing keyring from gnupg (safest bet), or </li><li><b>Close without saving</b> to start fresh with an empty keyring (you will be asked to create a new PGP key to work with RetroShare, or import a previously saved pgp keypair). </li><li><b>Cancel</b> to quit and forge a keyring by yourself (needs some PGP skills)</li></ul>"));
|
||||||
@ -108,6 +110,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (initResult < 0) {
|
if (initResult < 0) {
|
||||||
/* Error occured */
|
/* Error occured */
|
||||||
|
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
||||||
|
/* Translate into the desired language */
|
||||||
|
LanguageSupport::translate(LanguageSupport::defaultLanguageCode());
|
||||||
|
|
||||||
QMessageBox mb(QMessageBox::Critical, QObject::tr("RetroShare"), "", QMessageBox::Ok);
|
QMessageBox mb(QMessageBox::Critical, QObject::tr("RetroShare"), "", QMessageBox::Ok);
|
||||||
mb.setWindowIcon(QIcon(":/images/rstray3.png"));
|
mb.setWindowIcon(QIcon(":/images/rstray3.png"));
|
||||||
|
|
||||||
@ -133,7 +139,6 @@ int main(int argc, char *argv[])
|
|||||||
RshareSettings::Create ();
|
RshareSettings::Create ();
|
||||||
|
|
||||||
/* Setup The GUI Stuff */
|
/* Setup The GUI Stuff */
|
||||||
delete dummyApp;
|
|
||||||
Rshare rshare(args, argc, argv,
|
Rshare rshare(args, argc, argv,
|
||||||
QString::fromUtf8(RsInit::RsConfigDirectory().c_str()));
|
QString::fromUtf8(RsInit::RsConfigDirectory().c_str()));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user