Fix some undefined behaviour
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com> (cherry picked from commit bf1084d7fa6503b65bdb63374e5f92020ae4a3d1)
This commit is contained in:
parent
e2526c80c8
commit
9616d898d4
@ -113,14 +113,14 @@ if ((CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebI
|
||||
else()
|
||||
# AppleClang and Clang
|
||||
message(STATUS "Address Sanitizer available on Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=null")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=null")
|
||||
endif()
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# GCC
|
||||
message(STATUS "Address Sanitizer available on GCC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover")
|
||||
link_libraries("asan")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
message(STATUS "Address Sanitizer available on MSVC")
|
||||
|
@ -32,12 +32,12 @@ class LogModel : public QAbstractListModel {
|
||||
|
||||
private /* types */:
|
||||
struct entry {
|
||||
MessageLevel::Enum level;
|
||||
QString line;
|
||||
MessageLevel::Enum level = MessageLevel::Enum::Unknown;
|
||||
QString line = {};
|
||||
};
|
||||
|
||||
private: /* data */
|
||||
QVector<entry> m_content;
|
||||
QVector<entry> m_content = {};
|
||||
int m_maxLines = 1000;
|
||||
// first line in the circular buffer
|
||||
int m_firstLine = 0;
|
||||
|
@ -40,7 +40,7 @@ class CheckComboModel : public QIdentityProxyModel {
|
||||
{
|
||||
if (role == Qt::CheckStateRole) {
|
||||
auto txt = QIdentityProxyModel::data(index, Qt::DisplayRole).toString();
|
||||
return checked.contains(txt) ? Qt::Checked : Qt::Unchecked;
|
||||
return m_checked.contains(txt) ? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
if (role == Qt::DisplayRole)
|
||||
return QIdentityProxyModel::data(index, Qt::DisplayRole);
|
||||
@ -50,10 +50,10 @@ class CheckComboModel : public QIdentityProxyModel {
|
||||
{
|
||||
if (role == Qt::CheckStateRole) {
|
||||
auto txt = QIdentityProxyModel::data(index, Qt::DisplayRole).toString();
|
||||
if (checked.contains(txt)) {
|
||||
checked.removeOne(txt);
|
||||
if (m_checked.contains(txt)) {
|
||||
m_checked.removeOne(txt);
|
||||
} else {
|
||||
checked.push_back(txt);
|
||||
m_checked.push_back(txt);
|
||||
}
|
||||
emit dataChanged(index, index);
|
||||
emit checkStateChanged();
|
||||
@ -61,13 +61,13 @@ class CheckComboModel : public QIdentityProxyModel {
|
||||
}
|
||||
return QIdentityProxyModel::setData(index, value, role);
|
||||
}
|
||||
QStringList getChecked() { return checked; }
|
||||
QStringList getChecked() { return m_checked; }
|
||||
|
||||
signals:
|
||||
void checkStateChanged();
|
||||
|
||||
private:
|
||||
QStringList checked;
|
||||
QStringList m_checked = {};
|
||||
};
|
||||
|
||||
CheckComboBox::CheckComboBox(QWidget* parent) : QComboBox(parent), m_separator(", ")
|
||||
@ -92,7 +92,7 @@ void CheckComboBox::setSourceModel(QAbstractItemModel* new_model)
|
||||
|
||||
void CheckComboBox::hidePopup()
|
||||
{
|
||||
if (!containerMousePress)
|
||||
if (!m_containerMousePress)
|
||||
QComboBox::hidePopup();
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ bool CheckComboBox::eventFilter(QObject* receiver, QEvent* event)
|
||||
}
|
||||
case QEvent::MouseButtonPress: {
|
||||
auto ev = static_cast<QMouseEvent*>(event);
|
||||
containerMousePress = ev && view()->indexAt(ev->pos()).isValid();
|
||||
m_containerMousePress = ev && view()->indexAt(ev->pos()).isValid();
|
||||
break;
|
||||
}
|
||||
case QEvent::Wheel:
|
||||
|
@ -58,7 +58,7 @@ class CheckComboBox : public QComboBox {
|
||||
void toggleCheckState(int index);
|
||||
|
||||
private:
|
||||
QString m_default_text;
|
||||
QString m_separator;
|
||||
bool containerMousePress;
|
||||
QString m_default_text = {};
|
||||
QString m_separator = {};
|
||||
bool m_containerMousePress = false;
|
||||
};
|
Loading…
Reference in New Issue
Block a user