mirror of
https://github.com/RetroShare/RetroShare.git
synced 2026-09-12 19:50:17 +05:00
gui(forums): create reload timer before setGroupId (fix ctor SIGSEGV)
The coalescing timer was allocated near the end of the constructor, but setGroupId(forumId) is called earlier and synchronously reaches groupIdChanged() -> updateDisplay(true) -> mDeferredReloadTimer->stop(), dereferencing the still-uninitialised pointer and crashing the moment a forum was opened. Allocate the timer right after setupUi(), before setGroupId(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
839293f84d
commit
3860f76dc1
@ -254,6 +254,13 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Single-shot timer used to coalesce the full-forum reloads requested by
|
||||
// incoming GXS events (see scheduleForumReload()). Created first thing:
|
||||
// setGroupId(forumId) below reaches updateDisplay(), which touches this timer.
|
||||
mDeferredReloadTimer = new QTimer(this);
|
||||
mDeferredReloadTimer->setSingleShot(true);
|
||||
connect(mDeferredReloadTimer, &QTimer::timeout, this, [this]() { updateDisplay(true); });
|
||||
|
||||
//setUpdateWhenInvisible(true);
|
||||
|
||||
//mUpdating = false;
|
||||
@ -375,12 +382,6 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
||||
ui->threadTreeWidget->enableColumnCustomize(true);
|
||||
#endif
|
||||
|
||||
// Single-shot timer used to coalesce the full-forum reloads requested by
|
||||
// incoming GXS events (see scheduleForumReload()).
|
||||
mDeferredReloadTimer = new QTimer(this);
|
||||
mDeferredReloadTimer->setSingleShot(true);
|
||||
connect(mDeferredReloadTimer, &QTimer::timeout, this, [this]() { updateDisplay(true); });
|
||||
|
||||
mEventHandlerId = 0;
|
||||
// Needs to be asynced because this function is called by another thread!
|
||||
rsEvents->registerEventsHandler(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user