Actions
Bug #13733
openDbo::QueryModel and category chart
Start date:
05/08/2025
Due date:
% Done:
0%
Estimated time:
Description
I have a QueryModel<tuple<string, int, int>>
and a category chart
My application instantly crashes
/usr/include/c++/15.1.1/bits/stl_vector.h:1263: constexpr std::vector< <template-parameter-1-1>, <template-parameter-1-2> >::reference std::vector< <template-parameter-1-1>, <template-parameter-1-2> >::operator[](size_type) [with _Tp = std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>; _Alloc = std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >; reference = std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
I tried replacing chart with TableView and can confirm that there are no issues with the query itself.
According to the debugger, QueryModel::data
is somehow called with invalid index, which is not checked
Updated by Andrey Alekseev 22 days ago
Temporarily solved this by a proxy model
class HotfixProxy : public WIdentityProxyModel {
public:
cpp17::any data(const WModelIndex &index, ItemDataRole role) const override {
if ( index.isValid() )
return WIdentityProxyModel::data(index, role);
return {};
}
};
Updated by Matthias Van Ceulebroeck 18 days ago
- Status changed from New to InProgress
- Assignee set to Matthias Van Ceulebroeck
- Target version set to 4.12.2
Hey Andrey,
thanks for the report. This seems to have been in the code for a very long time. The model that converts the original source model to be usable by the charts implementations (WStandardChartProxyModel) retrieved data for an invalid index. For all other models this is fine, and an invalid index can be quickly checked, but this bounds check was not correctly added for the QueryModel.
Updated by Matthias Van Ceulebroeck 17 days ago
- Status changed from InProgress to Review
- Assignee deleted (
Matthias Van Ceulebroeck)
Actions