Skip to content

Commit

Permalink
[View] Work around GThreadPool 1 pointer bug.
Browse files Browse the repository at this point in the history
* Also fix typo in icon fetcher.
  • Loading branch information
DaveDavenport committed Mar 8, 2024
1 parent 0bf0c51 commit af6fb83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/rofi-icon-fetcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static void rofi_icon_fetch_entry_free(gpointer data);
IconFetcher *rofi_icon_fetcher_data = NULL;

static void rofi_icon_fetch_thread_pool_entry_remove(gpointer data) {
IconFetcherNameEntry *entry = (IconFetcherNameEntry *)data;
IconFetcherEntry *entry = (IconFetcherEntry *)data;
// Mark it in a way it should be re-fetched on next query?
}
static void rofi_icon_fetch_entry_free(gpointer data) {
Expand Down
9 changes: 9 additions & 0 deletions source/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -2653,6 +2653,15 @@ static int rofi_thread_workers_sort(gconstpointer a, gconstpointer b,

static void rofi_thread_pool_state_free(gpointer data) {
if (data) {
// This is a weirdness from glib that should not happen.
// It pushes in a 1 to msg sleeping threads to wake up.
// This should be removed from queue to avoid hitting this method.
// In practice, we still hit it (and crash)
if (GPOINTER_TO_UINT(data) == 1) {
// Ignore this entry.
g_debug("Glib thread-pool bug, received pointer with value 1.");
return;
}
thread_state *ts = (thread_state *)data;
if (ts->free) {
ts->free(data);
Expand Down

0 comments on commit af6fb83

Please sign in to comment.