mirror of
https://github.com/gwm17/Specter.git
synced 2024-11-22 18:28:52 -05:00
Fix seg fault in CharonClient due to out of order initialization.
This commit is contained in:
parent
72190d93a3
commit
8e9fcffa65
|
@ -120,11 +120,8 @@ namespace Specter {
|
|||
|
||||
if (ImGui::Button("Ok"))
|
||||
{
|
||||
SPEC_INFO("Here");
|
||||
PhysicsStartEvent event(m_chosenLocation, m_chosenType, m_chosenWindow, m_chosenPort, m_bitflags);
|
||||
SPEC_INFO("Here");
|
||||
Application::Get().OnEvent(event);
|
||||
SPEC_INFO("Here");
|
||||
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace Specter {
|
|||
void ImGuiLayer::OnImGuiRender()
|
||||
{
|
||||
//Demo's used to figure out how to do things.
|
||||
//Should not be on for actual NavProject for
|
||||
//Should not be on for actual SpecProject for
|
||||
//real use
|
||||
//static bool show = true;
|
||||
//ImGui::ShowDemoWindow(&show);
|
||||
|
|
|
@ -18,15 +18,14 @@ namespace Specter {
|
|||
//loc=either an ip address or a file location, port=address port, or unused in case of file
|
||||
DataSource* CreateDataSource(const std::string& location, const std::string& port, uint16_t header, DataSource::SourceType type, uint64_t coincidenceWindow)
|
||||
{
|
||||
SPEC_INFO("Here in create with type: {0} loc:{1} port:{2} ", ConvertDataSourceTypeToString(type), location, port);
|
||||
switch(type)
|
||||
{
|
||||
case DataSource::SourceType::CompassOffline : SPEC_INFO("CompassOff"); return new CompassRun(location, coincidenceWindow);
|
||||
case DataSource::SourceType::CompassOnline : SPEC_INFO("CompassOn"); return new CompassOnlineSource(location, port, header, coincidenceWindow);
|
||||
case DataSource::SourceType::DaqromancyOffline: SPEC_INFO("DaqOff"); return new DYFileSource(location, coincidenceWindow);
|
||||
case DataSource::SourceType::DaqromancyOnline: SPEC_INFO("DaqOn"); return new DYOnlineSource(location, port, coincidenceWindow);
|
||||
case DataSource::SourceType::CharonOnline: SPEC_INFO("CharOn"); return new CharonOnlineSource(location, port);
|
||||
case DataSource::SourceType::None: SPEC_INFO("None"); return nullptr;
|
||||
case DataSource::SourceType::CompassOffline: return new CompassRun(location, coincidenceWindow);
|
||||
case DataSource::SourceType::CompassOnline: return new CompassOnlineSource(location, port, header, coincidenceWindow);
|
||||
case DataSource::SourceType::DaqromancyOffline: return new DYFileSource(location, coincidenceWindow);
|
||||
case DataSource::SourceType::DaqromancyOnline: return new DYOnlineSource(location, port, coincidenceWindow);
|
||||
case DataSource::SourceType::CharonOnline: return new CharonOnlineSource(location, port);
|
||||
case DataSource::SourceType::None: return nullptr;
|
||||
}
|
||||
SPEC_WARN("Invalid DataSourceType at CreateDataSource!");
|
||||
return nullptr;
|
||||
|
|
|
@ -109,7 +109,6 @@ namespace Specter {
|
|||
SPEC_PROFILE_FUNCTION();
|
||||
std::scoped_lock<std::mutex> guard(m_sourceMutex); //Shouldn't matter for this, but safety first
|
||||
m_source.reset(CreateDataSource(event.GetSourceLocation(), event.GetSourcePort(), event.GetBitFlags(), event.GetSourceType(), event.GetCoincidenceWindow()));
|
||||
SPEC_INFO("Here");
|
||||
if (m_source->IsValid())
|
||||
{
|
||||
SPEC_INFO("Attach successful. Enabling data pull...");
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Specter {
|
|||
CharonClient::CharonClient(const std::string& hostname, const std::string& port) :
|
||||
m_socket(m_context)
|
||||
{
|
||||
SPEC_INFO("here");
|
||||
Connect(hostname, port);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ namespace Specter {
|
|||
void ReadHeader();
|
||||
void ReadBody();
|
||||
|
||||
asio::ip::tcp::socket m_socket;
|
||||
asio::io_context m_context;
|
||||
asio::ip::tcp::socket m_socket;
|
||||
std::thread m_ioThread;
|
||||
|
||||
StygianMessage m_tempMessage;
|
||||
|
|
|
@ -7,7 +7,6 @@ namespace Specter {
|
|||
CharonOnlineSource::CharonOnlineSource(const std::string& hostname, const std::string& port) :
|
||||
DataSource(0), m_client(hostname, port)
|
||||
{
|
||||
SPEC_INFO("Here");
|
||||
m_validFlag = m_client.IsConnected();
|
||||
m_readyEvents.emplace_back();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user