Re: Pre-approval for cwidget upload to fix a deadlock (511708 and friends)
And just for the sake of completeness, here's the debdiff for my
proposed upload.
Daniel
diff -u cwidget-0.5.12/debian/changelog cwidget-0.5.12/debian/changelog
--- cwidget-0.5.12/debian/changelog
+++ cwidget-0.5.12/debian/changelog
@@ -1,3 +1,10 @@
+cwidget (0.5.12-4) unstable; urgency=low
+
+ * Backport a fix for a nasty deadlock that was causing aptitude to
+ freeze up after running dpkg. (Closes: #511708)
+
+ -- Daniel Burrows <dburrows@debian.org> Tue, 27 Jan 2009 23:18:01 -0800
+
cwidget (0.5.12-3) unstable; urgency=low
* Fix the string truncation fix so that it doesn't enter an infinite
only in patch2:
unchanged:
--- cwidget-0.5.12.orig/src/cwidget/toplevel.cc
+++ cwidget-0.5.12/src/cwidget/toplevel.cc
@@ -446,8 +446,13 @@
void operator()()
{
- threads::mutex::lock l(input_event_mutex);
- input_event_fired = false;
+ // Don't hold the lock for longer than we need to (we lock it
+ // here to be extra-paranoid about changing the value of
+ // input_event_fired).
+ {
+ threads::mutex::lock l(input_event_mutex);
+ input_event_fired = false;
+ }
// Important note: this routine only blocks indefinitely in
// select() and pthread_cond_wait(), assuming no bugs in
@@ -480,6 +485,12 @@
}
else
{
+ // Lock the mutex and wait on the condition variable.
+ // We have to be careful to release the mutex when we
+ // leave this scope; otherwise we could end up being
+ // canceled while we hold the mutex, which leads to
+ // horrible stuff like bug #511708.
+ threads::mutex::lock l(input_event_mutex);
post_event(new get_input_event(input_event_mutex,
input_event_fired,
input_event_condition));
Reply to: