[ktimetracker] [Bug 452237] kTimeTracker crashes when Continue or Revert buttons are pressed

2023-03-12 Thread Alexander Potashev
https://bugs.kde.org/show_bug.cgi?id=452237

Alexander Potashev  changed:

   What|Removed |Added

 Status|CONFIRMED   |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #4 from Alexander Potashev  ---
Thanks for investigating!

The bugfix commit
https://invent.kde.org/frameworks/kidletime/-/commit/cd5040684723b87c7ba5b7cc1b1a63402902a641
was included in 5.93.0. Update KF5 minimum version to 5.93.0.

-- 
You are receiving this mail because:
You are watching all bug changes.

[ktimetracker] [Bug 452237] kTimeTracker crashes when Continue or Revert buttons are pressed

2022-11-15 Thread Christof Kaufmann
https://bugs.kde.org/show_bug.cgi?id=452237

--- Comment #1 from Christof Kaufmann  ---
*** Bug 460264 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are watching all bug changes.

[ktimetracker] [Bug 452237] kTimeTracker crashes when Continue or Revert buttons are pressed

2022-11-15 Thread Christof Kaufmann
https://bugs.kde.org/show_bug.cgi?id=452237

Christof Kaufmann  changed:

   What|Removed |Added

 Status|REPORTED|CONFIRMED
 Ever confirmed|0   |1
 CC||christofkaufmann.dev@gmail.
   ||com

--- Comment #2 from Christof Kaufmann  ---
I can confirm this bug and investigated why it occurs. I like to share my
findings.

This bug also occurs on Ubuntu 22.04 and generally when using Frameworks
versions 5.92 and probably also 5.93. It is independent on the version of
KTimeTracker. The bug hides in KIdleTime and has been resolved before 5.94 in
this commit:
https://invent.kde.org/frameworks/kidletime/-/commit/cd5040684723b87c7ba5b7cc1b1a63402902a641

It is triggered, when the IdleTimeDetector::timeoutReached method returns,
because it removes the timeout within the timeoutReached event:
https://invent.kde.org/pim/ktimetracker/-/blob/master/src/idletimedetector.cpp#L67
This invalidates the iterators of the loop that iterates the timeouts:
https://invent.kde.org/frameworks/kidletime/-/commit/cd5040684723b87c7ba5b7cc1b1a63402902a641#6d37565e8c6a5cca30eb46326cb4141a54de39df_291_291
A valgrind backtrace is "appended" below

Though it has been fixed upstream, I like to discuss how to workaround the
issue. The proper solution is to update Frameworks (including KIdleTime), but
for Ubuntu this requires to update from 22.04 (LTS) to 22.10 (non-LTS). A
backport seems not to be available. What's the best way to avoid that bug?

valgrind backtrace:
Invalid read of size 8
   at: QHashData::nextNode(QHashData::Node*) (qhash.cpp:589)
   by: QtPrivate::QFunctorSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*,
QObject*, void**, bool*) (qhash.h:426)
   by: call (qobjectdefs_impl.h:398)
   by: void doActivate(QObject*, int, void**) (qobject.cpp:3886)
   by: AbstractSystemPoller::timeoutReached(int)
(moc_abstractsystempoller.cpp:189)
   by: UnknownInlinedFun (xsyncbasedpoller.cpp:295)
   by: UnknownInlinedFun (xsyncbasedpoller.cpp:279)
   by: UnknownInlinedFun (xsyncbasedpoller.cpp:44)
   by: XSyncBasedPollerHelper::nativeEventFilter(QByteArray const&, void*,
long*) (xsyncbasedpoller.cpp:39)
   by: QAbstractEventDispatcher::filterNativeEvent(QByteArray const&, void*,
long*) (qabstracteventdispatcher.cpp:495)
   by: QXcbConnection::handleXcbEvent(xcb_generic_event_t*)
(qxcbconnection.cpp:536)
   by: QXcbConnection::processXcbEvents(QFlags)
(qxcbconnection.cpp:1014)
   by: xcbSourceDispatch(_GSource*, int (*)(void*), void*)
(qxcbeventdispatcher.cpp:103)
   by: g_main_context_dispatch (in
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.1)
   by: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.1)
   by: g_main_context_iteration (in
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.1)
 Address 0xb9de0a0 is 0 bytes inside a block of size 24 free'd
   atF: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by: UnknownInlinedFun (qhash.h:586)
   by: UnknownInlinedFun (qhash.h:886)
   by: KIdleTime::removeIdleTimeout(int) (kidletime.cpp:144)
   by: IdleTimeDetector::stopIdleDetection() (idletimedetector.cpp:129)
   by: IdleTimeDetector::timeoutReached(int, int) (idletimedetector.cpp:67)
   by: QtPrivate::FunctorCall,
QtPrivate::List, void, void (IdleTimeDetector::*)(int,
int)>::call(void (IdleTimeDetector::*)(int, int), IdleTimeDetector*, void**)
(qobjectdefs_impl.h:152)
   by: void QtPrivate::FunctionPointer::call, void>(void (IdleTimeDetector::*)(int,
int), IdleTimeDetector*, void**) (qobjectdefs_impl.h:185)
   by: QtPrivate::QSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*,
QObject*, void**, bool*) (qobjectdefs_impl.h:418)
   by: call (qobjectdefs_impl.h:398)
   by: void doActivate(QObject*, int, void**) (qobject.cpp:3886)
   by: KIdleTime::timeoutReached(int, int) (moc_kidletime.cpp:195)
   by: QtPrivate::QFunctorSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*,
QObject*, void**, bool*) (kidletime.cpp:296)
   by: call (qobjectdefs_impl.h:398)
   by: void doActivate(QObject*, int, void**) (qobject.cpp:3886)
   by: AbstractSystemPoller::timeoutReached(int)
(moc_abstractsystempoller.cpp:189)
 Block was alloc'd at
   at: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
   by: QHashData::allocateNode(int) (qhash.cpp:479)
   by: UnknownInlinedFun (qhash.h:610)
   by: UnknownInlinedFun (qhash.h:761)
   by: KIdleTime::addIdleTimeout(int) (kidletime.cpp:128)
   by: IdleTimeDetector::startIdleDetection() (idletimedetector.cpp:122)
   by: TaskView::startTimerFor(Task*, QDateTime const&) (taskview.cpp:268)
   by: TaskView::startTimerForNow(Task*) (taskview.cpp:284)
   by: TaskView::startCurrentTimer() (taskview.cpp:257)
   by: TaskView::onTaskDoubleClicked(Task*) (taskview.cpp:612)
   by: QtPrivate::FunctorCall,
QtPrivate::List, voi

[ktimetracker] [Bug 452237] kTimeTracker crashes when Continue or Revert buttons are pressed

2022-11-15 Thread Christof Kaufmann
https://bugs.kde.org/show_bug.cgi?id=452237

--- Comment #3 from Christof Kaufmann  ---
I made a workaround in my fork of the KTimeTracker code, for anyone, who can
compile the code:
https://invent.kde.org/ckaufmann/ktimetracker/-/tree/workaround_idle_crash

However, I do not plan to pose a merge request from it. I still hope for more
convenient ways to workaround the issue.

-- 
You are receiving this mail because:
You are watching all bug changes.