[Nepomuk] Review Request: Delete the IndexSchduler before its thread quits

Vishesh Handa me at vhanda.in
Tue Jul 31 16:38:31 UTC 2012



> On July 31, 2012, 4:12 p.m., Sebastian Trueg wrote:
> > services/fileindexer/fileindexer.cpp, line 105
> > <http://git.reviewboard.kde.org/r/105806/diff/1/?file=75561#file75561line105>
> >
> >     You do not delete the index scheduler before the thread quits here since you are deferring it to the event queue. Since the index scheduler lives in the thread you are about to quit the indexscheduler might not even be deleted at all... not sure, did you try to add a kdbebug to check?
> >     
> >

Well, the deleteLater() will send a 'DeferredDelete' event to the event loop which m_indexScheduler lives in. In this case that would be the event loop running in m_schedulingThread. That event loop will delete the object.

The thing is that I checked the QThread, and QEventLoop code, and none of them actually process all the events on quit. They just discard them. So, even though I'm getting the debug output (in IndexScheduler destructor), it might just be a fluke. The threads might be changing in between the m_indexScheduler->deleteLater() and the m_schedulingThread->quit();

Should I just call 'delete m_indexScheduler'? I'm scared that the index scheduler might be in the middle of a function at that point, and deleting it would result in a crash.

Weirdly enough. I also get the debug output without this patch. And no crashes when I try to access IndexSchduler's internal variables in the destructor.


- Vishesh


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/105806/#review16708
-----------------------------------------------------------


On July 31, 2012, 3:42 p.m., Vishesh Handa wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/105806/
> -----------------------------------------------------------
> 
> (Updated July 31, 2012, 3:42 p.m.)
> 
> 
> Review request for Nepomuk and Sebastian Trueg.
> 
> 
> Description
> -------
> 
>     The IndexScheduler lives in the m_schedulingThread, which should ideally
>     be deleted before the thread finishes execution.
> 
> 
> This addresses bug 301698.
>     http://bugs.kde.org/show_bug.cgi?id=301698
> 
> 
> Diffs
> -----
> 
>   services/fileindexer/fileindexer.cpp af8be4d 
> 
> Diff: http://git.reviewboard.kde.org/r/105806/diff/
> 
> 
> Testing
> -------
> 
> Nope. Cannot test this. In fact I'm not even sure if this was actually the reason for the crash.
> 
> 
> Thanks,
> 
> Vishesh Handa
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/nepomuk/attachments/20120731/ec48eb95/attachment.html>


More information about the Nepomuk mailing list