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

fix(linux): call gtk_init to fix tauri-apps/tauri#11312 #1036

Merged
merged 3 commits into from
Dec 29, 2024

Conversation

FabioGNR
Copy link
Contributor

This fixes tauri-apps/tauri#11312, this issue also contains some more information regarding this change.

To summarize, on Linux a crash is seen where gtk-rs fails an assert with error message "GTK may only be used from the main thread".

In tao, gtk::Application::new is used which should remove the need for calling gtk::init(). I believe there's a bug here, in either gtk-rs or gtk itself, but I've been unable to check this so far, where gtk::init() is not called or gtk-rs' internal INITIALIZED variable is not updated.

Later on at attempted use of a GTK function we get the failed assert and crash afterwards.

Adding an explicit gtk::init() call here fixes this issue. Calling this function multiple times should have no negative side effects, as there is a check to skip initializing when already done.

There are some unknowns:

  • Why was this introduced around 2.0.0? Did something previously call gtk_init through some (indirect) path?
  • Why does gtk::Application::new not work as expected?

Reference documentation:

@FabioGNR FabioGNR requested a review from a team as a code owner December 17, 2024 21:25
Copy link
Contributor

github-actions bot commented Dec 18, 2024

Package Changes Through d0af9bc

There are 1 changes which include tao with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
tao 0.31.0 0.31.1

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

Copy link
Member

@amrbashir amrbashir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@amrbashir amrbashir merged commit 83e35e9 into tauri-apps:dev Dec 29, 2024
18 checks passed
@github-actions github-actions bot mentioned this pull request Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] *intermittent* GTK may only be used from the main thread
2 participants