johnfactotum / foliate

Read e-books in style
https://johnfactotum.github.io/foliate/
GNU General Public License v3.0
5.26k stars 256 forks source link

Foliate just wont start, display is null #1267

Closed wscharff closed 3 months ago

wscharff commented 4 months ago

I just installed Foliate on a fresh Fedora 39 and it wont launch.

  1. Go to gnome Software
  2. Search for Foliate
  3. Install it
  4. Execute it -> Does not start

It wont open with flatpak from fedora nor flathub, same for fedora RPM.

Tried to understand what was wrong and running it with flatpak run com.github.johnfactotum.Foliate and I got

(com.github.johnfactotum.Foliate:2): Gjs-CRITICAL **: 17:54:14.896: JS ERROR: Error: Argument display may not be null
@resource:///com/github/johnfactotum/Foliate/themes.js:110:18

(com.github.johnfactotum.Foliate:2): Gjs-CRITICAL **: 17:54:14.896: Module file:///app/bin/foliate threw an exception

Cloned the repo from github and ran gjs -m src/main.js. Got the exact same error.

I added Gtk.init() after import declarationin main.js and it ran like a charm.

I tried to open the project in Gnome Builder, execute it and it ran like a charm (without the init obviously)

P.S : Yes, I am using dual monitor.

my system is :

System Details Report


Hardware Information:

Software Information:

Graphics:

Screenshot from 2024-03-03 18-10-01

wscharff commented 4 months ago

Here is the difference between Gnome Builder and if I omit that particular line with the gjs interpreter :

Screenshot from 2024-03-03 22-50-35

image

Apparently something is not set and/or ready when the application starts outside Gnome Builder. I reiterate, neither source code, flatpak or RPM works on my system. The call to Gdk.Display.get_default() just returns null in that case. What is strange is that this particular function is called in app.js:226, and this time it works.

=> Calling Gtk.init() in main.js genuinely seems to fix the issue

johnfactotum commented 3 months ago

The more "correct" fix would be adding the style provider after GTK is initialized, i.e. in the handler for the startup signal. Not sure why it works now, though.

SylChamber commented 3 months ago

I have the exact same error (NVidia graphics) since my KDE Neon upgraded itself to KDE Plasma 6 with Wayland session by default. I will wait for the fix.

SylChamber commented 3 months ago

I confirm that it was fixed in the latest Flatpak version, 3.1.1, which was updated yesterday.