On Sat, 14 Apr 2012 13:07:58 -0400, Scott Kitterman <deb...@kitterman.com>
wrote:
> Phil Thompson <p...@riverbankcomputing.com> wrote:
>
>>On Fri, 13 Apr 2012 11:52:31 -0300, "Alejandro J. Cura"
>><al...@canonical.com> wrote:
>>> Hi,
>>>
>>> first of all, since I'm new to the list I'd like to thank the people
>>> responsible for PyQt a lot for making such a great project.
>>>
>>> I'd like to report a bug: when using DBusQtMainLoop, I'm getting
>>> SIGSEGVs when the DBus connection is closed. I've managed to
>>reproduce
>>> this from Ubuntu Lucid (PyQt 4.7.2) up to Ubuntu Precise beta 2 (PyQt
>>> 4.9.1).
>>>
>>> Attached is a script that when ran shows the issue, but not every
>>time;
>>> on my Precise machine it happens about 3 out of 10 times; on a Lucid
>>VM
>>> it happens every time.
>>>
>>> Please let me know if I should attach any other info, or if there's
>>some
>>> simple way to fix it that I'm missing.
>>>
>>> BTW: I've seen this bug reported elsewhere[0] for projects using
>>PyQt,
>>> but I'm not sure where I should report it for PyQt.
>>>
>>> thanks!
>>
>>Should be fixed in tonight's PyQt snapshot.
>
> I suspect I will be able to figure it out by diffing the two snapshots,
> but I'd appreciate it if you would provide the patch that fixes this so
we
> can apply it to the current release. Ubuntu is very close to release,
so
> they aren't in a position to wait for the next PyQt release.
>
> Scott K
Attached.
Why wasn't the bug (which is 5 years old) not reported upstream earlier?
Phil
diff -r ec219159004e dbus/dbus.cpp
--- a/dbus/dbus.cpp Sat Apr 14 14:56:28 2012 +0100
+++ b/dbus/dbus.cpp Sat Apr 14 18:14:47 2012 +0100
@@ -1,7 +1,7 @@
// This is the SIP interface definition for the Qt support for the standard
// Python DBus bindings.
//
-// Copyright (c) 2012 Phil Thompson
+// Copyright (c) 2012 Riverbank Computing Limited
//
// Licensed under the Academic Free License version 2.1
//
@@ -271,7 +271,11 @@
{
watcher.read->setEnabled(false);
dbus_watch_handle(watcher.watch, DBUS_WATCH_READABLE);
- watcher.read->setEnabled(true);
+
+ // The notifier could have just been destroyed.
+ if (watcher.read)
+ watcher.read->setEnabled(true);
+
break;
}
@@ -295,7 +299,11 @@
{
watcher.write->setEnabled(false);
dbus_watch_handle(watcher.watch, DBUS_WATCH_WRITABLE);
- watcher.write->setEnabled(true);
+
+ // The notifier could have just been destroyed.
+ if (watcher.write)
+ watcher.write->setEnabled(true);
+
break;
}
diff -r ec219159004e dbus/helper.h
--- a/dbus/helper.h Sat Apr 14 14:56:28 2012 +0100
+++ b/dbus/helper.h Sat Apr 14 18:14:47 2012 +0100
@@ -1,7 +1,7 @@
// This is the declaration of the helper class for the Qt specific support for
// the standard Python DBus bindings.
//
-// Copyright (c) 2007 Phil Thompson
+// Copyright (c) 2012 Riverbank Computing Limited
//
// Licensed under the Academic Free License version 2.1
//
@@ -24,11 +24,12 @@
#include <QList>
#include <QMultiHash>
#include <QObject>
+#include <QPointer>
+#include <QSocketNotifier>
#include <dbus/dbus.h>
-class QSocketNotifier;
class QTimerEvent;
@@ -42,8 +43,8 @@
Watcher() : watch(0), read(0), write(0) {}
DBusWatch *watch;
- QSocketNotifier *read;
- QSocketNotifier *write;
+ QPointer<QSocketNotifier> read;
+ QPointer<QSocketNotifier> write;
};
typedef QMultiHash<int, Watcher> Watchers;
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt