Crash with QSharePointer

Pedro de Carvalho Gomes pedrogomes81 at gmail.com
Mon Mar 16 11:31:08 GMT 2020


Hi,

I have finished the porting of Last.fm service to Kf5. However I have been
having a crash which I can't identify the cause.

At the end of LastServer
destructor, controller->unregisterScrobblingService() is invoked. The
parameter is a QSharedPointer<ScrobblingService>, which encapsulates the
ScrobbleAdapter pointer to the LastFm
service. unregisterScrobblingService() removes the QSharedPointer fom a
QList of scrobbler services.

I noticed that the ScrobbleAdapter destructor is invoked after being
removed from the list, meaning that QSharePoint's reference counter is
zero. However, the invoking destructor method still has a reference to the
QSharedPointer. Thus, when it gets out of scope (after the if block ends),
QSharedPointer tries to delete the ScrobbleAdapter again, causing a
segmentation fault.

Any help to understand why the pointer is being deleted after invoking
QList.removeAll() is welcome.

Pedro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/amarok-devel/attachments/20200316/0586e770/attachment.html>


More information about the Amarok-devel mailing list