Merge pull request #1878 from csoler/v0.6-ImprovedGUI_4

[WIP] fixing some GUI bugs
This commit is contained in:
csoler 2020-04-26 15:49:01 +02:00 committed by GitHub
commit 07e71c3ea6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 33 deletions

View file

@ -543,10 +543,16 @@ void RsTypeSerializer::RawMemoryWrapper::serial_process(
break; break;
case RsGenericSerializer::DESERIALIZE: case RsGenericSerializer::DESERIALIZE:
{ {
// In case first,second is not properly initialized, we set them to nullptr,0
first = nullptr;
second = 0;
uint32_t serialSize = 0; uint32_t serialSize = 0;
RS_SERIAL_PROCESS(serialSize); RS_SERIAL_PROCESS(serialSize);
if(!ctx.mOk) break; if(!ctx.mOk) break;
ctx.mOk = serialSize <= MAX_SERIALIZED_CHUNK_SIZE; ctx.mOk = (serialSize <= MAX_SERIALIZED_CHUNK_SIZE);
if(!ctx.mOk) if(!ctx.mOk)
{ {
RsErr() << __PRETTY_FUNCTION__ RsErr() << __PRETTY_FUNCTION__
@ -565,25 +571,23 @@ void RsTypeSerializer::RawMemoryWrapper::serial_process(
break; break;
} }
ctx.mOk = ctx.mSize >= ctx.mOffset + serialSize; ctx.mOk = (ctx.mSize >= ctx.mOffset + serialSize);
if(!ctx.mOk) if(!ctx.mOk)
{ {
RsErr() << __PRETTY_FUNCTION__ << std::errc::no_buffer_space RsErr() << __PRETTY_FUNCTION__ << std::errc::no_buffer_space << std::endl;
<< std::endl;
print_stacktrace(); print_stacktrace();
clear(); clear();
break; break;
} }
if(serialSize != second) first = reinterpret_cast<uint8_t*>(malloc(serialSize));
{
first = reinterpret_cast<uint8_t*>(realloc(first, serialSize));
second = serialSize; second = serialSize;
}
memcpy(first, ctx.mData + ctx.mOffset, second); memcpy(first, ctx.mData + ctx.mOffset, serialSize);
ctx.mOffset += second; ctx.mOffset += serialSize;
break; break;
} }
case RsGenericSerializer::PRINT: break; case RsGenericSerializer::PRINT: break;

View file

@ -166,7 +166,13 @@ class RsTurtleRegExpSearchRequestItem: public RsTurtleFileSearchRequestItem
class RsTurtleGenericSearchRequestItem: public RsTurtleSearchRequestItem class RsTurtleGenericSearchRequestItem: public RsTurtleSearchRequestItem
{ {
public: public:
RsTurtleGenericSearchRequestItem() : RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_REQUEST) {} RsTurtleGenericSearchRequestItem()
: RsTurtleSearchRequestItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_REQUEST),
service_id(0),
search_data_len(0),
request_type(0),
search_data(nullptr)
{}
virtual ~RsTurtleGenericSearchRequestItem() { clear(); } virtual ~RsTurtleGenericSearchRequestItem() { clear(); }
uint16_t service_id ; // service to search uint16_t service_id ; // service to search
@ -221,7 +227,11 @@ class RsTurtleFTSearchResultItem: public RsTurtleSearchResultItem
class RsTurtleGenericSearchResultItem: public RsTurtleSearchResultItem class RsTurtleGenericSearchResultItem: public RsTurtleSearchResultItem
{ {
public: public:
RsTurtleGenericSearchResultItem() : RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_RESULT){} RsTurtleGenericSearchResultItem()
: RsTurtleSearchResultItem(RS_TURTLE_SUBTYPE_GENERIC_SEARCH_RESULT),
result_data(nullptr),
result_data_len(0)
{}
virtual ~RsTurtleGenericSearchResultItem() {} virtual ~RsTurtleGenericSearchResultItem() {}
uint32_t count() const { return result_data_len/50 ; } // This is a blind size estimate. We should probably use the actual size to limit search results. uint32_t count() const { return result_data_len/50 ; } // This is a blind size estimate. We should probably use the actual size to limit search results.

View file

@ -42,13 +42,9 @@ std::ostream& operator<<(std::ostream& o, const QModelIndex& i);// defined elsew
const QString RsGxsForumModel::FilterString("filtered"); const QString RsGxsForumModel::FilterString("filtered");
RsGxsForumModel::RsGxsForumModel(QObject *parent) RsGxsForumModel::RsGxsForumModel(QObject *parent)
: QAbstractItemModel(parent) : QAbstractItemModel(parent), mUseChildTS(false),mFilteringEnabled(false),mTreeMode(TREE_MODE_TREE)
{ {
initEmptyHierarchy(mPosts); initEmptyHierarchy(mPosts);
mUseChildTS=false;
mFilteringEnabled=false;
mTreeMode = TREE_MODE_TREE;
} }
void RsGxsForumModel::preMods() void RsGxsForumModel::preMods()

View file

@ -57,6 +57,7 @@ RSPermissionMatrixWidget::RSPermissionMatrixWidget(QWidget *parent)
:QFrame(parent) :QFrame(parent)
{ {
_painter = new QPainter(); _painter = new QPainter();
_current_service_id = 0;
setMouseTracking(true) ; setMouseTracking(true) ;