Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the crash on application launch under Windows #1252

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/kiwixapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ KiwixApp::KiwixApp(int& argc, char *argv[])
m_server(m_library.getKiwixLibrary(), mp_nameMapper),
mp_session(nullptr)
{
/* Place session file in our global library path */
QDir dir(m_libraryDirectory);
mp_session = new QSettings(dir.filePath("kiwix-desktop.session"),
QSettings::defaultFormat(), this);
try {
m_translation.setTranslation(QLocale());
} catch (std::exception& e) {
Expand Down Expand Up @@ -172,10 +176,6 @@ QString KiwixApp::findLibraryDirectory()

void KiwixApp::restoreTabs()
{
/* Place session file in our global library path */
QDir dir(m_libraryDirectory);
mp_session = new QSettings(dir.filePath("kiwix-desktop.session"),
QSettings::defaultFormat(), this);
QStringList tabsToOpen = mp_session->value("reopenTabList").toStringList();

/* Restart a new session to prevent duplicate records in openURL */
Expand Down
2 changes: 1 addition & 1 deletion src/suggestionlistdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ QString getElidedText(const QFont& font, int length, const QString& text)
const int textLength = length - elideMarkerLength;
QString elidedText = metrics.elidedText(text, Qt::ElideRight, textLength);
if (elidedText != text)
return elidedText.chopped(1);
return elidedText.isEmpty() ? "" : elidedText.chopped(1);
return text;
}

Expand Down
Loading