mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 12:23:37 -05:00
Revert "Another approach to track down a segmentation fault"
This reverts commit 403528e436
.
This commit is contained in:
parent
403528e436
commit
8c5e362830
@ -192,53 +192,53 @@ WSJTXLogging::~WSJTXLogging ()
|
|||||||
lg->remove_all_sinks ();
|
lg->remove_all_sinks ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Reroute Qt messages to the system logger
|
// Reroute Qt messages to the system logger
|
||||||
// void WSJTXLogging::qt_log_handler (QtMsgType type, QMessageLogContext const& context, QString const& msg)
|
void WSJTXLogging::qt_log_handler (QtMsgType type, QMessageLogContext const& context, QString const& msg)
|
||||||
// {
|
{
|
||||||
// std::cerr << "qt_log_handler: type: " << int(type) << " file: " << context.file << " line: " << context.line << " msg: " << msg.toStdString () << '\n';
|
std::cerr << "qt_log_handler: type: " << int(type) << " file: " << context.file << " line: " << context.line << " msg: " << msg.toStdString () << '\n';
|
||||||
|
|
||||||
// // Convert Qt message types to logger severities
|
// Convert Qt message types to logger severities
|
||||||
// auto severity = trivial::trace;
|
auto severity = trivial::trace;
|
||||||
// switch (type)
|
switch (type)
|
||||||
// {
|
{
|
||||||
// case QtDebugMsg: severity = trivial::debug; break;
|
case QtDebugMsg: severity = trivial::debug; break;
|
||||||
// case QtInfoMsg: severity = trivial::info; break;
|
case QtInfoMsg: severity = trivial::info; break;
|
||||||
// case QtWarningMsg: severity = trivial::warning; break;
|
case QtWarningMsg: severity = trivial::warning; break;
|
||||||
// case QtCriticalMsg: severity = trivial::error; break;
|
case QtCriticalMsg: severity = trivial::error; break;
|
||||||
// case QtFatalMsg: severity = trivial::fatal; break;
|
case QtFatalMsg: severity = trivial::fatal; break;
|
||||||
// }
|
}
|
||||||
// // Map non-default Qt categories to logger channels, Qt logger
|
// Map non-default Qt categories to logger channels, Qt logger
|
||||||
// // context is mapped to the appropriate logger attributes.
|
// context is mapped to the appropriate logger attributes.
|
||||||
// auto log = sys::get ();
|
auto log = sys::get ();
|
||||||
// std::string file;
|
std::string file;
|
||||||
// std::string function;
|
std::string function;
|
||||||
// if (context.file)
|
if (context.file)
|
||||||
// {
|
{
|
||||||
// file = context.file;
|
file = context.file;
|
||||||
// }
|
}
|
||||||
// if (context.function)
|
if (context.function)
|
||||||
// {
|
{
|
||||||
// function = context.function;
|
function = context.function;
|
||||||
// }
|
}
|
||||||
// if (!context.category || !qstrcmp (context.category, "default"))
|
if (!context.category || !qstrcmp (context.category, "default"))
|
||||||
// {
|
{
|
||||||
// BOOST_LOG_SEV (log, severity)
|
BOOST_LOG_SEV (log, severity)
|
||||||
// // << boost::log::add_value ("Line", context.line)
|
// << boost::log::add_value ("Line", context.line)
|
||||||
// // << boost::log::add_value ("File", file)
|
// << boost::log::add_value ("File", file)
|
||||||
// // << boost::log::add_value ("Function", function)
|
// << boost::log::add_value ("Function", function)
|
||||||
// << msg.toStdString ();
|
<< msg.toStdString ();
|
||||||
// }
|
}
|
||||||
// else
|
else
|
||||||
// {
|
{
|
||||||
// BOOST_LOG_CHANNEL_SEV (log, std::string {context.category}, severity)
|
BOOST_LOG_CHANNEL_SEV (log, std::string {context.category}, severity)
|
||||||
// // << boost::log::add_value ("Line", context.line)
|
// << boost::log::add_value ("Line", context.line)
|
||||||
// // << boost::log::add_value ("File", file)
|
// << boost::log::add_value ("File", file)
|
||||||
// // << boost::log::add_value ("Function", function)
|
// << boost::log::add_value ("Function", function)
|
||||||
// << msg.toStdString ();
|
<< msg.toStdString ();
|
||||||
// }
|
}
|
||||||
// if (QtFatalMsg == type)
|
if (QtFatalMsg == type)
|
||||||
// {
|
{
|
||||||
// // bail out
|
// bail out
|
||||||
// throw std::runtime_error {"Fatal Qt Error"};
|
throw std::runtime_error {"Fatal Qt Error"};
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
// time, it does not rely on an instance of WSJTXLogging existing,
|
// time, it does not rely on an instance of WSJTXLogging existing,
|
||||||
// so logging occurring before the logging sinks, filters, and
|
// so logging occurring before the logging sinks, filters, and
|
||||||
// formatters, etc, are established can take place.
|
// formatters, etc, are established can take place.
|
||||||
// static void qt_log_handler (QtMsgType type, QMessageLogContext const& context, QString const&);
|
static void qt_log_handler (QtMsgType type, QMessageLogContext const& context, QString const&);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
116
main.cpp
116
main.cpp
@ -71,34 +71,34 @@ namespace
|
|||||||
} seeding;
|
} seeding;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void safe_stream_QVariant (boost::log::record_ostream& os, QVariant const& v)
|
// void safe_stream_QVariant (boost::log::record_ostream& os, QVariant const& v)
|
||||||
{
|
// {
|
||||||
switch (static_cast<QMetaType::Type> (v.type ()))
|
// switch (static_cast<QMetaType::Type> (v.type ()))
|
||||||
{
|
// {
|
||||||
case QMetaType::QByteArray:
|
// case QMetaType::QByteArray:
|
||||||
os << "0x" << v.toByteArray ().toHex (':').toStdString ();
|
// os << "0x" << v.toByteArray ().toHex (':').toStdString ();
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case QMetaType::QBitArray:
|
// case QMetaType::QBitArray:
|
||||||
{
|
// {
|
||||||
auto const& bits = v.toBitArray ();
|
// auto const& bits = v.toBitArray ();
|
||||||
os << "0b";
|
// os << "0b";
|
||||||
for (int i = 0; i < bits.size (); ++ i)
|
// for (int i = 0; i < bits.size (); ++ i)
|
||||||
{
|
// {
|
||||||
os << (bits[i] ? '1' : '0');
|
// os << (bits[i] ? '1' : '0');
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
default:
|
// default:
|
||||||
os << v.toString ();
|
// os << v.toString ();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// ::qInstallMessageHandler (&WSJTXLogging::qt_log_handler);
|
::qInstallMessageHandler (&WSJTXLogging::qt_log_handler);
|
||||||
init_random_seed ();
|
init_random_seed ();
|
||||||
|
|
||||||
// make the Qt type magic happen
|
// make the Qt type magic happen
|
||||||
@ -325,42 +325,42 @@ int main(int argc, char *argv[])
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
// dump settings
|
// dump settings
|
||||||
auto sys_lg = sys::get ();
|
// auto sys_lg = sys::get ();
|
||||||
if (auto rec = sys_lg.open_record
|
// if (auto rec = sys_lg.open_record
|
||||||
(
|
// (
|
||||||
boost::log::keywords::severity = boost::log::trivial::trace)
|
// boost::log::keywords::severity = boost::log::trivial::trace)
|
||||||
)
|
// )
|
||||||
{
|
// {
|
||||||
boost::log::record_ostream strm (rec);
|
// boost::log::record_ostream strm (rec);
|
||||||
strm << "++++++++++++++++++++++++++++ Settings ++++++++++++++++++++++++++++\n";
|
// strm << "++++++++++++++++++++++++++++ Settings ++++++++++++++++++++++++++++\n";
|
||||||
for (auto const& key: multi_settings.settings ()->allKeys ())
|
// for (auto const& key: multi_settings.settings ()->allKeys ())
|
||||||
{
|
// {
|
||||||
if (!key.contains (QRegularExpression {"^MultiSettings/[^/]*/"}))
|
// if (!key.contains (QRegularExpression {"^MultiSettings/[^/]*/"}))
|
||||||
{
|
// {
|
||||||
auto const& value = multi_settings.settings ()->value (key);
|
// auto const& value = multi_settings.settings ()->value (key);
|
||||||
if (value.canConvert<QVariantList> ())
|
// if (value.canConvert<QVariantList> ())
|
||||||
{
|
// {
|
||||||
auto const sequence = value.value<QSequentialIterable> ();
|
// auto const sequence = value.value<QSequentialIterable> ();
|
||||||
strm << key << ":\n";
|
// strm << key << ":\n";
|
||||||
for (auto const& item: sequence)
|
// for (auto const& item: sequence)
|
||||||
{
|
// {
|
||||||
strm << "\t";
|
// strm << "\t";
|
||||||
safe_stream_QVariant (strm, item);
|
// safe_stream_QVariant (strm, item);
|
||||||
strm << '\n';
|
// strm << '\n';
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
strm << key << ": ";
|
// strm << key << ": ";
|
||||||
safe_stream_QVariant (strm, value);
|
// safe_stream_QVariant (strm, value);
|
||||||
strm << '\n';
|
// strm << '\n';
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
strm << "---------------------------- Settings ----------------------------\n";
|
// strm << "---------------------------- Settings ----------------------------\n";
|
||||||
strm.flush ();
|
// strm.flush ();
|
||||||
sys_lg.push_record (boost::move (rec));
|
// sys_lg.push_record (boost::move (rec));
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Create and initialize shared memory segment
|
// Create and initialize shared memory segment
|
||||||
// Multiple instances: use rig_name as shared memory key
|
// Multiple instances: use rig_name as shared memory key
|
||||||
|
Loading…
Reference in New Issue
Block a user