foliate
foliate copied to clipboard
Crash When Changing Theme (Flatpak)
Describe the bug At least since the last Flathub update, upon attempting to change the Theme, the app immediately crashes. Before the crash, Terminal shows the following error,
"Failed to create /home/kiba/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling.",
which may or may not be related. There is no Terminal error shown as a consequence of the crash. Foliate just disappears without any explanation.
To Reproduce Steps to reproduce the behavior:
- Open Foliate.
- Open an epub.
- Click hamburger -> Theme -> anything = Apollo 13'd.
- No error message, just gone.
Expected behavior The Theme changer should change the theme, not make Foliate vanish without a trace.
Screenshots n/a
Version:
- Foliate version: 2.6.3
- OS/Distribution and version: Fedora 33-34
- Desktop environment: GNOME 40
- Installation method: Faltpak
Additional context The emotional context of this report is a combination sadness and gratitude. Foliate is objectively the best reading app on any platform, so thanks for taking a look at this.
Also experiencing this bug. Foliate crashes immediately upon switching themes. However, it sometimes doesn't do this when ran from the command "flatpak run com.github.johnfactotum.Foliate".
Version:
- Foliate version: 2.6.3
- OS/Distribution and version: Pop!_OS 20.10
- Desktop environment: GNOME 3.38.3
- Installation method: Flatpak
Also affects Ubuntu.
Version:
- Foliate version: 2.6.2
- OS/Distribution and version: Ubuntu 21.04
- Desktop environment: GNOME 3.38.4
- Installation method: Flatpak
NOTE: the snap version and the meson version do not have this bug.
I have new information to see if you can reproduce.
On up-to-date Fedora 34 I have narrowed down the crash to --
gjs version 1.68.0-5.fc34.x86_64 as soon as the app closes, which I believe makes this bug a near-duplicate of another recent bug I read about, but I can't seem to find it now. The solution for both may be the incorporation of gjs in the flatpak.
I always set Foliate to not open last book. That is, I set Foliate to open to the Library first, then I open an epub form there. Every time I open an epub from the Library and attempt to change the theme, Foliate crashes.
However, a workaround seems to be if I leave Foliate's default open setting (which is why others may not be noticing this bug), open a book, close and reopen the app, and so the app opens directly to my last opened epub, then I can change the theme freely without crashing.
Thanks again for working on this, and I hope this library identification and workaround helps.
Tested on Ubuntu 21.04:
Running in terminal with:
flatpak run com.github.johnfactotum.Foliate --verbose
the crash happens after:
run_javascript: setStyle({...})
.
Yes, it is possibe to change themes if you have the setting "Open the last opened file on startup" switched on (true).
Can you reproduce with --verbose
, @JohannPopper ?
Tested on RHEL 8.4
Version:
- Foliate Version: 2.6.3
- GNOME: 3.32.2
- Installation method: Flatpak
Also, I noticed that Foliate crashes when trying to set the Advanced option: Realistic Shadows.
I also run in terminal with:
flatpak run com.github.johnfactotum.Foliate --verbose
Thank you, @itprojects, for the hint!
And the crash also happened after:
run_javascript: setStyle({...})
Which may, or may not be related.
@przmv Either the bug is more serious, or it's another bug.
The Realistic Shadows crash is reproducible on Ubuntu 21.04 with flatpak (Foliate v2.6.3).
Viewing EPUB: crash when changing theme. or brightness
Zorin OS 16 (based on ubuntu latest).
As mentioned above, only crashes when changing theme and using the Flatpak installation on Ubuntu 21.10. Using the Snap store there are no issues/zero crashes.
Tested on Fedora 35.
Version:
- Foliate version: 2.6.3
- OS/Distribution and version: Fedora 35
- Desktop Environment: GNOME 41.1
- Instalation method: Flatpak
As mentioned above, the app crashes when trying to change theme, brightness or toggling the 'Realistic Shadows' option.
By building Foliate with the 3.38 runtime, the crash doesn't happen anymore. However, just like the meson build, I got the following warnings when performing any of the actions above:
(com.github.johnfactotum.Foliate:2): Gtk-CRITICAL **: 11:15:44.528: gtk_widget_get_scale_factor: assertion 'GTK_IS_WIDGET (widget)' failed
(com.github.johnfactotum.Foliate:2): Gtk-CRITICAL **: 11:15:44.528: gtk_widget_get_scale_factor: assertion 'GTK_IS_WIDGET (widget)' failed
(com.github.johnfactotum.Foliate:2): Gtk-CRITICAL **: 11:15:44.528: gtk_widget_get_scale_factor: assertion 'GTK_IS_WIDGET (widget)' failed
Running Foliate with Sdk runtime 40 and through the gjs debugger I got this:
db> bt full
#0 _themeUI() at resource:///com/github/johnfactotum/Foliate/js/window.js:1361:25
invert = [object Function]
brightness = 1
bgColor = "rgb(253,246,227)"
fgColor = "rgb(147,161,161)"
cssProvider = [object GObject_Object]
#1 <anonymous>([object GObject_Object], "fg-color") at resource:///com/github/johnfactotum/Foliate/js/window.js:959:65
arguments = [object Arguments]
#2 <anonymous>("fg-color", [object Array]) at resource:///org/gnome/gjs/modules/core/overrides/Gio.js:516:45
arguments = [object Arguments]
id = "fg-color"
args = [object Array]
#3 <anonymous>([object GObject_Object]) at resource:///com/github/johnfactotum/Foliate/js/theme.js:243:13
fg_color = "#93a1a1"
bg_color = "#002b36"
link_color = "#268bd2"
invert = false
dark_mode = true
#4 <anonymous>([object GObject_Object], [object GObject_Object]) at resource:///com/github/johnfactotum/Foliate/js/window.js:99:26
arguments = [object Arguments]
_ = [object GObject_Object]
row = [object GObject_Object]
#5 main([object Array]) at resource:///com/github/johnfactotum/Foliate/js/main.js:478:23
restore = true
openHint = ""
held = false
application = [object GObject_Object]
#6 run([object GjsScriptModule]) at resource:///org/gnome/gjs/modules/script/package.js:206:18
arguments = [object Arguments]
module = [object GjsScriptModule]
#7 toplevel at /app/bin/com.github.johnfactotum.Foliate:9:16
db> list
1356 }
1357 .foliate-autohide-label {
1358 color: ${fgColor};
1359 opacity: 0.5;
1360 }`)
*1361 Gtk.StyleContext.add_provider_for_screen(
1362 Gdk.Screen.get_default(),
1363 cssProvider,
1364 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
1365 }
1366 get epub() {
db> next
_themeUI() at resource:///com/github/johnfactotum/Foliate/js/window.js:1361:25
Segmentation fault (core dumped)
Because the crash is happening when the epub window is created from the library window, I changed the open()
method from the LibraryWindow
class to:
open(file) {
new Window({ application: this.application, file }).present()
// this.close() <-- don't close the LibraryWindow
}
With this change I was able to run Foliate normally with any runtime. Both the crash and the critical warnings were gone (but of course, this is not a solution to the problem).
Maybe the code to change theme is somehow trying to reference an invalid widget?
Here is my output when running it on Flatpak. Phosh 0.17.0-1pureos1, 720x1440, L5, mobile, Foliate 2.6.4. Also silently crashes for me, tried a couple different themes same result:
There is a lot going on but other than the crash the .var mesa_shader_cache directory and cache files exist even though it complains they dont.
###@###:~$ flatpak run com.github.johnfactotum.Foliate --verbosePortal call failed: Failed to start command: Failed to execute child process “dict” (No such file or directory) Portal call failed: Failed to start command: Failed to execute child process “sdcv” (No such file or directory) Gjs-Message: 09:12:30.735: JS LOG: book list: loading more items Gjs-Message: 09:12:30.736: JS LOG: book list: loading items Gjs-Message: 09:12:30.736: JS LOG: Loading book library Failed to create /home/purism/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling. Failed to create /home/purism/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling. Gjs-Message: 09:12:42.800: JS LOG: ready Gjs-Message: 09:12:42.803: JS LOG: run_javascript: doubleClickTime = 400 Gjs-Message: 09:12:42.805: JS LOG: run_javascript: imgEventType = "click" Gjs-Message: 09:12:42.807: JS LOG: run_javascript: windowSize = 360 Gjs-Message: 09:12:42.808: JS LOG: run_javascript: windowHeight = 554 Gjs-Message: 09:12:42.813: JS LOG: run_javascript: zoomLevel = 1 Gjs-Message: 09:12:42.816: JS LOG: run_javascript: enableFootnote = true Gjs-Message: 09:12:42.820: JS LOG: run_javascript: autohideCursor = false Gjs-Message: 09:12:42.825: JS LOG: run_javascript: open( decodeURI("file:///run/user/1000/doc/53f6080d/The%2520Ghost%2520Brigades%2520(Old%2520Man's%2520War%2520Book%25202)%2520-%2520Scalzi,%2520John.epub"), dec... Gjs-Message: 09:12:44.521: JS LOG: book-ready Gjs-Message: 09:12:44.526: JS LOG: run_javascript: JSON.stringify(book.package.metadata) Gjs-Message: 09:12:44.528: JS LOG: run_javascript: JSON.stringify(book.navigation.toc) Gjs-Message: 09:12:44.534: JS LOG: cover Gjs-Message: 09:12:44.581: JS LOG: saving file uri Gjs-Message: 09:12:44.586: JS LOG: saving cover to /home/purism/.var/app/com.github.johnfactotum.Foliate/cache/com.github.johnfactotum.Foliate/urn%3Auuid%3A273fd756-62f2-4858-8d67-99e08f24bba9.png Gjs-Message: 09:12:44.640: JS LOG: run_javascript: loadLocations(["epubcfi(/6/2!/4[text]/4[htp01]/2/2,/1:0,/1:18)","epubcfi(/6/4!/4[text]/4[tp01],/2/2/1:0,/6/2/1:11)","epubcfi(/6/6!/4/2,/2/1:0,/4/2/2/2/3:3)","epubcfi(/6/8!/4[text]/4[ded01]/2,/1:0,/1:1... Gjs-Message: 09:12:44.642: JS LOG: run_javascript: render() Gjs-Message: 09:12:44.819: JS LOG: locations-ready Gjs-Message: 09:12:44.820: JS LOG: run_javascript: JSON.stringify(sectionMarks) Gjs-Message: 09:12:45.177: JS LOG: rendition-ready Gjs-Message: 09:12:45.182: JS LOG: run_javascript: setStyle({"fontFamily":"Serif","fontSize":16,"fontWeight":400,"fontStyle":"normal","fontStretch":"normal","spacing":1.5,"margin":40,"maxWidth":1400,"usePublisherFont":false,"justify":true,"hyphenate":... Gjs-Message: 09:12:45.183: JS LOG: run_javascript: setupRendition() Gjs-Message: 09:12:45.185: JS LOG: run_javascript: display('epubcfi(/6/14!/4[text]/4[ch01]/4/28/1:30)') Gjs-Message: 09:12:45.308: JS LOG: layout Gjs-Message: 09:12:45.583: JS LOG: writing to /home/purism/.var/app/com.github.johnfactotum.Foliate/data/com.github.johnfactotum.Foliate/urn%3Auuid%3A273fd756-62f2-4858-8d67-99e08f24bba9.json Gjs-Message: 09:12:45.605: JS LOG: book list: updating urn:uuid:273fd756-62f2-4858-8d67-99e08f24bba9 Gjs-Message: 09:12:45.688: JS LOG: book list: updating urn:uuid:273fd756-62f2-4858-8d67-99e08f24bba9 Gjs-Message: 09:12:45.688: JS LOG: writing to /home/purism/.var/app/com.github.johnfactotum.Foliate/data/com.github.johnfactotum.Foliate/library/uri-store.json Gjs-Message: 09:12:47.696: JS LOG: book-displayed Gjs-Message: 09:12:47.919: JS LOG: relocated Gjs-Message: 09:12:47.919: JS LOG: epubcfi(/6/14!/4[text]/4[ch01]/4/28/1:30) Gjs-Message: 09:12:48.926: JS LOG: writing to /home/purism/.var/app/com.github.johnfactotum.Foliate/data/com.github.johnfactotum.Foliate/urn%3Auuid%3A273fd756-62f2-4858-8d67-99e08f24bba9.json Gjs-Message: 09:12:48.934: JS LOG: book list: updating urn:uuid:273fd756-62f2-4858-8d67-99e08f24bba9 Gjs-Message: 09:12:48.988: JS LOG: book list: updating urn:uuid:273fd756-62f2-4858-8d67-99e08f24bba9 Gjs-Message: 09:12:52.425: JS LOG: run_javascript: setStyle({"fontFamily":"Serif","fontSize":16,"fontWeight":400,"fontStyle":"normal","fontStretch":"normal","spacing":1.5,"margin":40,"maxWidth":1400,"usePublisherFont":false,"justify":true,"hyphenate":
Same problem on RHEL 9
Same problem on Kubuntu LTS 22
Same problem on Linux Mint 20.3, Flatpak version. The workarounds above work well.
Foliate (Flatpak 2.6.4) stops crashing (when changing Themes or using the brightness wheel) after setting the "Open the last opened file on startup" option to true.
Foliate (Flatpak 2.6.4) stops crashing (when changing Themes or using the brightness wheel) after setting the "Open the last opened file on startup" option to true.
but it's already enabled by default and it's still crashing.
but it's already enabled by default and it's still crashing.
Yes, it does crash even if enabled but you have to have at least one book in your library and then after having selected and viewed a book, close Foliate and launch it again. It never crashed once I had Foliate open on the last viewed book. Making any changes after navigating from the library to the book does make Foliate crash.
but it's already enabled by default and it's still crashing.
Yes, it does crash even if enabled but you have to have at least one book in your library and then after having selected and viewed a book, close Foliate and launch it again. It never crashed once I had Foliate open on the last viewed book.
This worked for me -- the crash doesn't occur if I skip the library. I can change themes as many times as I want.
But if I return to the library, the next attempt to change theme on that run triggers a crash.
https://github.com/johnfactotum/foliate/issues/719#issuecomment-1399576137
I have done this and the crashing when changing theme settings and the like have stopped. I'm on nixos stable
Getting same behavior as hisekai and L911P on NixOS unstable: changing theme settings caused a crash whenever I had navigated to it from the library or when I had the open last book from startup option off, but it works fine in the instance of a book opened automatically at startup.
Tengo nueva información para ver si se puede reproducir.
En Fedora 34 actualizado, he reducido el bloqueo a:
gjs versión 1.68.0-5.fc34.x86_64 tan pronto como se cierra la aplicación, lo que creo que hace que este error sea casi un duplicado de otro error reciente sobre el que leí, pero parece que no puedo encontrarlo ahora. La solución para ambos puede ser la incorporación de gjs en el flatpak.
Siempre configuro Foliate para que no abra el último libro. Es decir, configuro Foliate para que se abra primero en la Biblioteca, luego abro un formulario epub allí. Cada vez que abro un epub de la Biblioteca e intento cambiar el tema, Foliate falla.
Sin embargo, una solución parece ser si dejo la configuración de apertura predeterminada de Foliate (razón por la cual es posible que otros no noten este error), abro un libro, cierro y vuelvo a abrir la aplicación, y así la aplicación se abre directamente en mi último epub abierto, luego Puedo cambiar el tema libremente sin fallar.
Gracias nuevamente por trabajar en esto, y espero que esta identificación de la biblioteca y la solución ayuden.
This fixes the problem
Foliate (Flatpak 2.6.4) stops crashing (when changing Themes or using the brightness wheel) after setting the "Open the last opened file on startup" option to true.
actually making it false fixes mine. (Pop!_OS, flatpak)
Edit: Actually if you want to change theme, you need to turn it on and off for once every startup of foliate.
Closing as obsolete with the release of the GTK 4 version. Feel free to open new issues if you have problems with the new version.