Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Save a reference to messagebox in EditorStack to avoid memory to be freed. #4870

Merged
merged 3 commits into from
Aug 2, 2017

Conversation

rlaverde
Copy link
Member

@rlaverde rlaverde commented Jul 31, 2017

Fixes: #4453
Fixes: #4442

I tried different solutions, like returning the focus, or checking if the widget is alive, but didn't work

This solution works better, and I think that's a cleaner solution (thanks @goanpeca for the idea)

Only two of the message box was related two the errors mentioned above, but I also change the others because they could raise the same error (but that use cases are less common)

@rlaverde rlaverde added this to the v3.2.1 milestone Jul 31, 2017
@rlaverde rlaverde self-assigned this Jul 31, 2017
@rlaverde rlaverde requested review from ccordoba12 and goanpeca July 31, 2017 21:58
Copy link
Member

@goanpeca goanpeca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

Any chance of adding a test?

@ccordoba12
Copy link
Member

There's a syntax error in Python 2, that's why our tests are failing.

buttons,
parent=self)

answer = self.msgbox.exec()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlaverde in PyQt, we always use exec_() with the underscore

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, sometimes I forget about python2.7 :(

) % (osp.basename(finfo.filename),
str(error)),
self)
self.msgbox.exec()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlaverde in PyQt, we always use exec_() with the underscore

) % (osp.basename(finfo.filename),
str(error)),
self)
self.msgbox.exec()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlaverde in PyQt, we always use exec_() with the underscore

"<br>Do you want to close it?") % name,
QMessageBox.Yes | QMessageBox.No,
self)
answer = self.msgbox.exec()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlaverde in PyQt, we always use exec_() with the underscore

"your changes?") % name,
QMessageBox.Yes | QMessageBox.No,
self)
answer = self.msgbox.exec()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlaverde in PyQt, we always use exec_() with the underscore

) % osp.basename(filename),
QMessageBox.Yes | QMessageBox.No,
self)
answer = self.msgbox.exec()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlaverde in PyQt, we always use exec_() with the underscore

"automatically.") % name,
QMessageBox.Ok,
self)
self.msgbox.exec()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlaverde in PyQt, we always use exec_() with the underscore

…reed.

If the memory is freed, segfaults could happen when trying to access the C objects.
@@ -672,6 +672,29 @@ def test_open_files_in_new_editor_window(main_window, qtbot):


@flaky(max_runs=3)
def test_close_when_file_is_changed(main_window, qtbot):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is hanging in Travis with the pip wheels. So please skip it when PYQT_WHEEL

@goanpeca
Copy link
Member

goanpeca commented Aug 1, 2017

@ccordoba12 merging?

@ccordoba12
Copy link
Member

Yep. Thanks @rlaverde, great work!

@ccordoba12 ccordoba12 merged commit f447c51 into spyder-ide:3.x Aug 2, 2017
ccordoba12 added a commit that referenced this pull request Aug 2, 2017
@rlaverde rlaverde deleted the fix-segfaults branch August 2, 2017 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants