0
我有一个使用CORBA/ACE连接两个分布式模块的项目,当我将我的解决方案从MSVS2008传输到MSVS2015时,我遇到了访问冲突错误使用ACE_DEBUG功能项目的写日志,当我跟随代码我发现空指针错误这部分的代码之前是:用于编写调试日志的ace log_msg.cpp库文件中的访问冲突错误
if (tracing)
this->start_tracing();
这是Log_Msg.cpp是王牌库的文件。这里是错误产生的功能:
ssize_t
ACE_Log_Msg::log (ACE_Log_Record &log_record,
int suppress_stderr)
{
ssize_t result = 0;
// Format the message and print it to stderr and/or ship it off to
// the log_client daemon, and/or print it to the ostream. Of
// course, only print the message if "SILENT" mode is disabled.
if (ACE_BIT_DISABLED (ACE_Log_Msg::flags_,
ACE_Log_Msg::SILENT))
{
bool tracing = this->tracing_enabled();
this->stop_tracing();
#if !defined (ACE_WIN32)
// Make this block signal-safe.
ACE_Log_Msg_Sig_Guard sb;
#endif /* !ACE_WIN32 */
// Do the callback, if needed, before acquiring the lock
// to avoid holding the lock during the callback so we don't
// have deadlock if the callback uses the logger.
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_,
ACE_Log_Msg::MSG_CALLBACK)
&& this->msg_callback() != 0)
this->msg_callback()->log (log_record);
// Make sure that the lock is held during all this.
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
*ACE_Log_Msg_Manager::get_lock(),
-1));
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_,
ACE_Log_Msg::STDERR)
&& !suppress_stderr) // This is taken care of by our caller.
log_record.print (ACE_Log_Msg::local_host_,
ACE_Log_Msg::flags_,
stderr);
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::CUSTOM) ||
ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::SYSLOG) ||
ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER))
{
// Be sure that there is a message_queue_, with multiple threads.
ACE_MT (ACE_Log_Msg_Manager::init_backend());
}
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER) ||
ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::SYSLOG))
{
result =
ACE_Log_Msg_Manager::log_backend_->log (log_record);
}
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::CUSTOM) &&
ACE_Log_Msg_Manager::custom_backend_ != 0)
{
result =
ACE_Log_Msg_Manager::custom_backend_->log (log_record);
}
// This must come last, after the other two print operations
// (see the <ACE_Log_Record::print> method for details).
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_,
ACE_Log_Msg::OSTREAM)
&& this->msg_ostream() != 0)
log_record.print (ACE_Log_Msg::local_host_,
ACE_Log_Msg::flags_,
#if defined (ACE_LACKS_IOSTREAM_TOTALLY)
static_cast<FILE *> (this->msg_ostream())
#else /* ! ACE_LACKS_IOSTREAM_TOTALLY */
*this->msg_ostream()
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
);
if (tracing)
this->start_tracing();
}
return result;
}
我用__try/__除了和其他异常处理程序,但我无法解决它。我在MSVS2008中没有这样的错误。也许我应该设置一些设置或添加新文件,但我不知道它是什么。
请帮我:(
谢谢你的回答,但ACE :: init()已经添加到initializa项目的部分我也测试将它添加到其他地方进行初始化,但仍然存在相同的问题。是否有必要将ACE :: init()添加到其他部分? –
我在我的问题中说过,我们没有MSVS2008这样的错误,并且自从我们将项目转移到2015年,问题就开始了! –
您是否使用msvc2015重新编译了ACE/TAO? –