! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
[PATCH] xfce4-netload-plugin: Fix removing GSources
Status:
RESOLVED: INVALID
Product:
Xfce4-netload-plugin
Component:
General

Comments

Description Harald Judt 2014-10-25 21:59:12 CEST
Created attachment 5705 
fix-removing-gsources.patch

On startup, xfce4-netload-plugin spills out the following CRITICAL GLib Error:
GLib-CRITICAL **: Source ID 5 was not found when attempting to remove it

This patch makes it check to see if a GSource exists before destroying it,
since any GSource may be destroyed early in the main event loop if its
dispatch callback returns FALSE.
Comment 1 Landry Breuil editbugs 2014-10-26 16:27:22 CET
That 4 identical chunks change calls for a function, no ? :)
Comment 2 Landry Breuil editbugs 2014-10-26 16:39:31 CET
Created attachment 5706 
use a function to remove the gsource

How about this ?
Comment 3 Harald Judt 2014-10-26 18:28:17 CET
Yes, I guess that should work too ;-)
Comment 4 Harald Judt 2014-10-26 18:52:25 CET
But you forgot the return type.
Comment 5 Landry Breuil editbugs 2014-10-26 21:35:45 CET
oh, right. anyway, i dont have write access to netload's repo, and i realized it wasnt converted to build as a module or install files in panel/plugins dirs like every other plugin.. mike, since you're the maintainer, any opinion on this ? i'll gladly cherrypick some patches and make a maintainance release if i can get write to git/releases and you dont plan to work on that soon...
Comment 6 Mike Massonnet editbugs 2014-11-02 15:46:02 CET
actually i never triggered that bug, but lets see.

glib actually does exactly this for you while removing a source:

https://git.gnome.org/browse/glib/tree/glib/gmain.c?h=glib-2-32#n1845

sooo, wontfix since it does not sound logical to do the following check twice.

g_source_remove(guint tag)
{
    GSource *source;
    
    source = g_main_context_find_source_by_id(NULL, tag);
    if (source)
    {
        g_source_destroy(source);
    }
}

Bug #11250

Reported by:
Harald Judt
Reported on: 2014-10-25
Last modified on: 2014-11-02

People

Assignee:
Florian Rivoal
CC List:
2 users

Version

Attachments

fix-removing-gsources.patch (2.83 KB, patch)
2014-10-25 21:59 CEST , Harald Judt
no flags
use a function to remove the gsource (2.17 KB, patch)
2014-10-26 16:39 CET , Landry Breuil
no flags

Additional information