Theodor Ciobanu - 2013-12-18

Stack trace is:
#0 0x000000080346e26a in thr_kill () from /lib/libc.so.7
#1 0x0000000803535ac9 in abort () from /lib/libc.so.7
#2 0x000000080255d4c5 in g_thread_abort () from /usr/local/lib/libglib-2.0.so.0
#3 0x000000080255d4f5 in g_mutex_unlock () from /usr/local/lib/libglib-2.0.so.0
#4 0x000000000040cf2d in parcellite_init () at main.c:2100
#5 0x000000000040ce24 in main (argc=1, argv=0x7fffffffda38) at main.c:2294

According to the docs:
Calling g_mutex_unlock() on a mutex that is not locked by the current thread leads to undefined behaviour.

So I added a check before that unlock:

--- src/main.c.orig 2013-12-17 16:38:05.000000000 +0200
+++ src/main.c 2013-12-18 15:08:47.000000000 +0200
@@ -2097,7 +2097,8 @@
}
clip_lock= g_mutex_new();
hist_lock= g_mutex_new();
- g_mutex_unlock(clip_lock);
+ if (!g_mutex_trylock(clip_lock))
+ g_mutex_unlock(clip_lock);

show_icon=!get_pref_int32("no_icon");
/ Read history /

And it seems to be working OK now.