[PyQt] Strange observation

Phil Thompson phil at riverbankcomputing.com
Fri Jun 21 22:12:42 BST 2013


On Fri, 21 Jun 2013 18:54:15 +0200, Detlev Offenbach
<detlev at die-offenbachs.de> wrote:
> Hello,
> 
> there was a strange observation reported using eric5. The eric5 PySvn 
> plug-in has a dialog to ask the user for a password. This is embedded in

> code like this
> 
>         cursor = QApplication.overrideCursor()
>         if cursor is not None:
>             QApplication.restoreOverrideCursor()
> <call the login dialog, could take some time depending upon the user>
>         if cursor is not None:
>             QApplication.setOverrideCursor(cursor)
> 
> Every now and than this code fails with
> <class 'RuntimeError'>: 
> wrapped C/C++ object of type QCursor has been deleted
> 
> What is wrong with my code?

Probably...

overrideCursor() returns a pointer to an internal copy of the cursor. This
is deleted by restoreOverrideCursor().

Before calling restoreOverrideCursor() make a copy...

    cursor = QCursor(cursor)

Phil


More information about the PyQt mailing list