question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attempt to delete CallTipWidget after the C/C++ object has been deleted

See original GitHub issue

When shutting down an application which has an embedded QtConsole, I get the following error with v5.2.0, which does not occur in v5.1.1.

RuntimeError                              Traceback (most recent call last)
~/opt/miniconda3/envs/py38/lib/python3.8/site-packages/qtconsole/call_tip_widget.py in <lambda>()
     21         assert isinstance(text_edit, (QtWidgets.QTextEdit, QtWidgets.QPlainTextEdit))
     22         super().__init__(None, QtCore.Qt.ToolTip)
---> 23         text_edit.destroyed.connect(lambda: self.deleteLater())
     24 
     25         self._hide_timer = QtCore.QBasicTimer()

RuntimeError: wrapped C/C++ object of type CallTipWidget has been deleted

It appears to happen when calling the QApplication quit function, so I guess the standard PyQt shutdown process doesn’t guarantee that the C/C++ ToolTip widget is destroyed after the QTextEdit widget. I can get around this by explicitly closing the console widget, which is a sub-class of FrontendWidget, before calling quit.

I am raising this as an issue because I wanted to find out if this was the expected behavior. Are you assuming that the FrontendWidget is always explicitly closed when shutting down an application using QtConsole? That wasn’t necessary before the change. It might be possible to prevent this by subclassing the CallTipWidget deleteLater function to catch this exception, which would ensure that other applications don’t break.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rayosborncommented, Nov 15, 2021

That was my fault for listing the traceback that was generated by the error. It still doesn’t make sense to me that the traceback points to CallTipWidget.__init__, whereas the problem occurs when destroying it. I will submit a new PR shortly.

0reactions
ccordoba12commented, Nov 15, 2021

I don’t think this fixes the issue

Sorry, I thought this could be solved with a simple try/except.

This is what I added to the CallTipWidget class

Looks good to me. My only recommendation is to catch RuntimeError instead of leaving a bare except there. Could you make a pull request for it? Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

the operation cannot be performed because the object has ...
When I try to send a meeting invitation, the error "the operation cannot be performed because the object has been deleted" occur.
Read more >
Understanding the "underlying C/C++ object has been deleted ...
If the C++ part is deleted by Qt, an empty Python wrapper object will be left behind. And if you attempt to call...
Read more >
Microsoft Outlook - The operation cannot be performed ...
Go to File > Account Settings > Account Name and Sync Settings · Set the "Root Folder Path" to "Inbox".
Read more >
deleting snapshot 'xxx' object has been deleted - XenConvert
now I deleting snapshot. some message in notifications "deleting snapshot 'xxx' object has been deleted". what can I do?
Read more >
Delete Operation Too Large - but all related records have ...
We have worked around this problem by setting a 'status' field on the parent object to indicate that we want it deleted. After...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found