#diary
15 posts · Last used Sep 24
Do you know what happens when you write C+++ Qt code with web dev experience? Your mental model for memory management (which is non-existent because JS has GC), leads to memory leaks.
It's so bad I had to:
-
rewrite most of the init code for member variables in almost all widgets so the expectation of "WidgetA" from "child C" of MainWindow is available when "WidgetB" emits a signal.
-
currently debugging memory leak when MainWindow is closed - huh? Yup, I have a WindowActivate event that triggers a "status" update and ALL important widgets listen to the signal emitted by THIS fn to update the state.
-
A connect() is causing seg fault right now when I update the widget's state multiple times in a row. (still haven't checked this out yet)
-
clang-tidy is labelling cosmetic things like "Class *obj = new Class();" into "auto *obj = new Class();" and my OCD is annoyed.
Found the culprit! It was the max_id parameter in /api/v1/timeline/api/v1/timelines/home endpoint.
The code inside Tokodon is as follows:
// maintimelinemodel.cpp
if (!fromId.isEmpty() && !query.hasQueryItem(QStringLiteral("max_id"))) {
// TODO: this is an *upper bound* so it always is one less than the last post we read
// is this really how it's supposed to work wrt read markers?
query.addQueryItem(QStringLiteral("max_id"), fromId);
}
This code can be searched via max_id keyword. You need to comment out the query.addQueryItem line and Tokodon will work just fine.
I think this is a BUG for the following reasons:
max_idinvalidation failure- Lack of retry logic w/o this query item when we know API response (
datavariable) is empty. - When user logged out, all such data should be deleted as well. A full logout from the app should've reset this data.
A part of me thinks this info was sent by Mastodon server as part of my account info.
@tokodon@kde.social @kde@floss.social
This is in Manjaro Linux fully updated with #Qt 6.10
This was a fun bug to track though :)

