Bug 414375

Summary: Cannot start KBibTex; getting error "You need to instantiate a Q*Application before using KCatalog"
Product: [Applications] KBibTeX Reporter: Nuno Gomes <nunogomes.pt+kde>
Component: GeneralAssignee: Thomas Fischer <fischer>
Status: RESOLVED FIXED    
Severity: normal CC: lueck
Priority: NOR    
Version: 0.9.1   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Screenshot of terminal command and output.

Description Nuno Gomes 2019-11-21 19:00:13 UTC
Created attachment 124050 [details]
Screenshot of terminal command and output.

SUMMARY
Whenever I start KBibTex by clicking the icon in the Application Menu, nothing happens; when trying to start it from the terminal, I get the following error message:
```
ASSERT failure in KCatalogPrivate::setupGettextEnv: "You need to instantiate a Q*Application before using KCatalog", file /build/src/ki18n/src/kcatalog.cpp, line 203
Aborted (core dumped)
```

STEPS TO REPRODUCE
1. Install latest version of KBibTex
2. Try to start it either from the Application Menu or from the terminal
3. 

OBSERVED RESULT
The application does not start. In the terminal, you get the following error message:
```
ASSERT failure in KCatalogPrivate::setupGettextEnv: "You need to instantiate a Q*Application before using KCatalog", file /build/src/ki18n/src/kcatalog.cpp, line 203
Aborted (core dumped)
```


EXPECTED RESULT
KBibTex should start normally.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Manjaro Linux / KDE 5.64.0 / Plasma 5.17.3
(available in About System)
KDE Plasma Version: KDE 5.64.0 / Plasma 5.17.3
KDE Frameworks Version: 5.64.0
Qt Version: 5.9.7

ADDITIONAL INFORMATION
This happens all the time, even if I restart the computer.
Comment 1 Burkhard Lück 2019-11-22 04:58:02 UTC
confirmed in recent master build from sources
Comment 2 Burkhard Lück 2019-11-22 05:28:01 UTC
This patch fixes the reported issue in master and makes kbibtex fully translated again:

$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6cb792f9..1c090ee4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,10 +16,6 @@ set(QT_MIN_VERSION 5.9.0)
 set(KF5_MIN_VERSION 5.51)
 find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
 
-add_definitions(
-    -DTRANSLATION_DOMAIN="kbibtex"
-)
-
 set(
     CMAKE_MODULE_PATH
     ${ECM_MODULE_PATH}

The definition of TRANSLATION_DOMAIN has to be used only to connect catalogs to library code, please read:

https://api.kde.org/frameworks/ki18n/html/prg_guide.html#link_lib


See also https://bugs.kde.org/show_bug.cgi?id=414385
Comment 3 Thomas Fischer 2019-11-22 08:37:48 UTC
Git commit 84c5042c79d14667c5d9cd685c009c3b7fe48e37 by Thomas Fischer.
Committed on 22/11/2019 at 08:37.
Pushed by thomasfischer into branch 'master'.

Fixing issues with translations

Fixing a crash that apparently is connected to a failed translation
of a string as reported in bug 414375.

Burkhard Lück <lueck@hube-lueck.de> provided a patch to CMakeLists.txt
which should fix this problem.

In addition to Burkhard's patch, a GUI issue was fixed so that empty
strings are not attempted to be translated leading to placeholder
messages shown instead of just nothing.

M  +0    -4    CMakeLists.txt
M  +6    -3    src/gui/config/entrylayout.cpp

https://commits.kde.org/kbibtex/84c5042c79d14667c5d9cd685c009c3b7fe48e37
Comment 4 Thomas Fischer 2019-11-22 08:39:48 UTC
I did not encounter the crash myself, but I trust two reporters and the provided fix that it solves this bug. A new commit has been made to 'master'.

I also addressed a GUI issue which I encountered in this context.
Comment 5 Thomas Fischer 2019-12-17 20:56:20 UTC
Git commit 59c0eb40c0dc137f712860444e9451b6ae53d562 by Thomas Fischer.
Committed on 11/12/2019 at 22:23.
Pushed by thomasfischer into branch 'kbibtex/0.9'.

Fixing issues with translations

Fixing a crash that apparently is connected to a failed translation
of a string as reported in bug 414375.

Burkhard Lück <lueck@hube-lueck.de> provided a patch to CMakeLists.txt
which should fix this problem.

This commit is a manual backport from master's commit 84c5042c79d1466
regarding file CMakeLists.txt, excluding the GUI fix.
Related: bug 414385
FIXED-IN: 0.9.2

M  +0    -1    CMakeLists.txt
M  +4    -0    ChangeLog

https://commits.kde.org/kbibtex/59c0eb40c0dc137f712860444e9451b6ae53d562
Comment 6 Thomas Fischer 2019-12-24 20:12:52 UTC
Git commit 3ecfcf8e2b815876a573635a618a2d90f067b40f by Thomas Fischer.
Committed on 24/12/2019 at 20:08.
Pushed by thomasfischer into branch 'kbibtex/0.10'.

Fixing issues with translations

Fixing a crash that apparently is connected to a failed translation
of a string as reported in bug 414375.

Burkhard Lück <lueck@hube-lueck.de> provided a patch to CMakeLists.txt
which should fix this problem.

In addition to Burkhard's patch, a GUI issue was fixed so that empty
strings are not attempted to be translated leading to placeholder
messages shown instead of just nothing.

This commit is a backport from master's commit 84c5042c79d14667c5d9cd.
Related: bug 414385

M  +0    -4    CMakeLists.txt
M  +5    -1    ChangeLog
M  +6    -3    src/gui/config/entrylayout.cpp

https://commits.kde.org/kbibtex/3ecfcf8e2b815876a573635a618a2d90f067b40f