After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 670185 - [PATCH] Use new GLib threading API
[PATCH] Use new GLib threading API
Status: RESOLVED FIXED
Product: eog
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: EOG Maintainers
EOG Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-02-16 05:50 UTC by Robert Ancell
Modified: 2012-02-19 13:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use new GLib threading API (7.83 KB, patch)
2012-02-16 05:50 UTC, Robert Ancell
accepted-commit_now Details | Review

Description Robert Ancell 2012-02-16 05:50:50 UTC
Created attachment 207729 [details] [review]
Use new GLib threading API

Use new GLib threading API

I've converted the remainder of EOG to use the new glib threading API.  I've attempted to make the code in src/eog-jobs.[ch] match the old API/ABI as I guess plugins will be accessing it?  Please check this code is safe.
Comment 1 Felix Riemann 2012-02-16 14:32:11 UTC
Review of attachment 207729 [details] [review]:

Thanks for patching, Robert. :)

The patch looks good to me so far.
What I'm going to check over the weekend is if we can leave the g_mutex_clear() calls in the dispose handlers or if we have to move them into a finalize handler.

::: src/eog-jobs.c
@@ +67,3 @@
+	/* NOTE: We need to allocate the mutex here so the ABI stays the same when it used to use g_mutex_new */
+	job->mutex = g_malloc (sizeof (GMutex));
+	g_mutex_init (job->mutex);

Oh, that's an interesting find.
I don't think plugins are supposed to touch that mutex, actually I fail to see the reason for this mutex at all. It's only used to protect the update of the progress value, yet the value is available unprotected (maybe that's the reason the mutex is public?).

It's probably safer to keep it that way for now though, but I'm seriously thinking about removing that mutex completely.
Comment 2 Felix Riemann 2012-02-18 12:04:04 UTC
(In reply to comment #1)
> Review of attachment 207729 [details] [review]:
> 
> Thanks for patching, Robert. :)
> 
> The patch looks good to me so far.
> What I'm going to check over the weekend is if we can leave the g_mutex_clear()
> calls in the dispose handlers or if we have to move them into a finalize
> handler.

I made a few tests and it looks like the g_mutex_clear() calls need to go to _finalize as _dispose can be called multiple times. Calling g_mutex_clear multiple times causes a double free and thus aborts the process.
Comment 3 Felix Riemann 2012-02-19 13:36:58 UTC
Committed your patch and moved the g_mutex_clear calls into finalize handlers.

Strangely git assumed I was the author of your patch (probably due to adding the bug URL to the commit message) and I only noticed that after pushing. Sorry, for that.

commit b5f61d90d0478378cf7cf21bf5ade9eded0ae9f2
Author: Felix Riemann <>
Date:   Sun Feb 19 14:13:40 2012 +0100

    Use new GLib threading API
    
    https://bugzilla.gnome.org/show_bug.cgi?id=670185
---
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.