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

[+HOTFIX!] memory viewer: Close all instances after emulation exit #9594

Merged
merged 2 commits into from Jan 12, 2021

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented Jan 12, 2021

Enhancmenets

  • Close all memory viewer instances after emulation exit.

Bugfixes

@Nekotekina
Copy link
Member

Is it legal to call delete on widgets? Otherwise idm probably isn't best tool for this task.

@elad335
Copy link
Contributor Author

elad335 commented Jan 12, 2021

It worked fine on my tests, @Megamouse is it safe to call delete on QDialog manually? This the main thread calling it.

@MSuih
Copy link
Member

MSuih commented Jan 12, 2021

Qt has these two warnings about deleting objects:

Warning: All child objects are deleted. If any of these objects are on the stack or global, sooner or later your program will crash. We do not recommend holding pointers to child objects from outside the parent. If you still do, the destroyed() signal gives you an opportunity to detect when an object is destroyed.

Warning: Deleting a QObject while pending events are waiting to be delivered can cause a crash. You must not delete the QObject directly if it exists in a different thread than the one currently executing. Use deleteLater() instead, which will cause the event loop to delete the object after all pending events have been delivered to it.

https://doc.qt.io/qt-5/qobject.html#dtor.QObject

The 2nd point is a bit dangerious, as f.ex. there might be a pending repaint event in the event loop.

@elad335
Copy link
Contributor Author

elad335 commented Jan 12, 2021

Fixed, made it use deleteLater() as QT spec recommends.

@elad335 elad335 force-pushed the memory branch 2 times, most recently from 9702706 to 3fb520e Compare January 12, 2021 20:05
@Megamouse
Copy link
Contributor

So is this guaranteed to be always alive when idm is done?
Also, is idm guaranteed to be done before the debugger is killed?

@elad335
Copy link
Contributor Author

elad335 commented Jan 12, 2021

IDM is alive as long as emulation is running, debugger is alive as long as main_window is alive so basically all the time.
When IDM is resetted (i.e. emulation stopping) the destructor of memory_viewer_handle is called.
If closed manually via the exit button finished() signal will remove its IDM entry, also causing the destructor to be called.

@Nekotekina Nekotekina merged commit e05f1c3 into RPCS3:master Jan 12, 2021
@elad335 elad335 deleted the memory branch March 16, 2021 15:23
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.

None yet

4 participants