fix crash bug when stopping scene #10
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 00f741c3c7535be4bac52836e999f293
|
||||||
|
timeCreated: 1483616285
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "Cursor.h"
|
#include "Cursor.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
#include "MonitorManager.h"
|
|
||||||
#include "Monitor.h"
|
#include "Monitor.h"
|
||||||
#include "Duplicator.h"
|
#include "Duplicator.h"
|
||||||
|
|
||||||
@@ -32,11 +31,6 @@ void Cursor::UpdateBuffer(Duplicator* duplicator)
|
|||||||
}
|
}
|
||||||
|
|
||||||
isVisible_ = frameInfo.PointerPosition.Visible != 0;
|
isVisible_ = frameInfo.PointerPosition.Visible != 0;
|
||||||
if (isVisible_)
|
|
||||||
{
|
|
||||||
GetMonitorManager()->SetCursorMonitorId(monitor->GetId());
|
|
||||||
}
|
|
||||||
|
|
||||||
x_ = frameInfo.PointerPosition.Position.x;
|
x_ = frameInfo.PointerPosition.Position.x;
|
||||||
y_ = frameInfo.PointerPosition.Position.y;
|
y_ = frameInfo.PointerPosition.Position.y;
|
||||||
timestamp_ = frameInfo.LastMouseUpdateTime;
|
timestamp_ = frameInfo.LastMouseUpdateTime;
|
||||||
|
|||||||
@@ -307,16 +307,7 @@ bool Duplicator::Duplicate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateMetadata();
|
UpdateMetadata();
|
||||||
|
UpdateCursor();
|
||||||
if (frameInfo.PointerPosition.Visible)
|
|
||||||
{
|
|
||||||
GetMonitorManager()->SetCursorMonitorId(monitor_->GetId());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetMonitorManager()->GetCursorMonitorId() == monitor_->GetId())
|
|
||||||
{
|
|
||||||
UpdateCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -324,9 +315,20 @@ bool Duplicator::Duplicate()
|
|||||||
|
|
||||||
void Duplicator::UpdateCursor()
|
void Duplicator::UpdateCursor()
|
||||||
{
|
{
|
||||||
auto cursor = GetMonitorManager()->GetCursor();
|
auto& manager = GetMonitorManager();
|
||||||
cursor->UpdateBuffer(this);
|
if (!manager) return;
|
||||||
cursor->Draw(this);
|
|
||||||
|
if (lastFrame_.info.PointerPosition.Visible)
|
||||||
|
{
|
||||||
|
manager->SetCursorMonitorId(monitor_->GetId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (monitor_->GetId() == manager->GetCursorMonitorId())
|
||||||
|
{
|
||||||
|
auto cursor = GetMonitorManager()->GetCursor();
|
||||||
|
cursor->UpdateBuffer(this);
|
||||||
|
cursor->Draw(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Monitor::Monitor(int id)
|
|||||||
|
|
||||||
Monitor::~Monitor()
|
Monitor::~Monitor()
|
||||||
{
|
{
|
||||||
|
duplicator_->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -65,6 +66,12 @@ void Monitor::Initialize(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Monitor::Finalize()
|
||||||
|
{
|
||||||
|
duplicator_->Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Monitor::Render()
|
void Monitor::Render()
|
||||||
{
|
{
|
||||||
const auto& frame = duplicator_->GetFrame();
|
const auto& frame = duplicator_->GetFrame();
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public:
|
|||||||
void Initialize(
|
void Initialize(
|
||||||
const Microsoft::WRL::ComPtr<struct IDXGIAdapter> &adapter,
|
const Microsoft::WRL::ComPtr<struct IDXGIAdapter> &adapter,
|
||||||
const Microsoft::WRL::ComPtr<struct IDXGIOutput> &output);
|
const Microsoft::WRL::ComPtr<struct IDXGIOutput> &output);
|
||||||
|
void Finalize();
|
||||||
void Render();
|
void Render();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ void MonitorManager::Initialize()
|
|||||||
|
|
||||||
void MonitorManager::Finalize()
|
void MonitorManager::Finalize()
|
||||||
{
|
{
|
||||||
|
for (const auto& monitor : monitors_)
|
||||||
|
{
|
||||||
|
monitor->Finalize();
|
||||||
|
}
|
||||||
|
|
||||||
monitors_.clear();
|
monitors_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user