mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
cellCamera: fix qt handler crash if object is destroyed from another thread
This commit is contained in:
parent
be972f04ac
commit
5e436984a2
1 changed files with 19 additions and 1 deletions
|
@ -1,7 +1,9 @@
|
|||
#include "stdafx.h"
|
||||
#include "qt_camera_handler.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Io/camera_config.h"
|
||||
#include "Emu/Cell/lv2/sys_event.h"
|
||||
|
||||
#include <QMediaService>
|
||||
#include <QCameraInfo>
|
||||
|
@ -21,7 +23,23 @@ qt_camera_handler::qt_camera_handler() : camera_handler_base()
|
|||
|
||||
qt_camera_handler::~qt_camera_handler()
|
||||
{
|
||||
close_camera();
|
||||
atomic_t<bool> wake_up = false;
|
||||
|
||||
Emu.CallAfter([&]()
|
||||
{
|
||||
close_camera();
|
||||
m_surface.reset();
|
||||
m_camera.reset();
|
||||
m_error_handler.reset();
|
||||
|
||||
wake_up = true;
|
||||
wake_up.notify_one();
|
||||
});
|
||||
|
||||
while (!wake_up)
|
||||
{
|
||||
thread_ctrl::wait_on(wake_up, false);
|
||||
}
|
||||
}
|
||||
|
||||
void qt_camera_handler::set_camera(const QCameraInfo& camera_info)
|
||||
|
|
Loading…
Add table
Reference in a new issue