[PATCH] juk: save TagEditor's configuration on exit.

Michael Pyne mpyne at kde.org
Sat Apr 30 03:25:17 BST 2011

On Friday, April 29, 2011 11:48:34 Γιώργος ΚÏ
λάφας wrote:
> Hi all,
> I noticed that every time I restarted Juk, I had to re-select
> View-->Show TagEditor for the latter to show up.
> After investigation, I found out that the TagEditor's configuration
> was not saved upon exit, becausePlaylistSplitter::m_editor was never
> delete-d in PlaylistSplitter's dtor, so TagEditor::saveConfig() was
> never called.

This is actually not true. If you put a kDebug() call into 
TagEditor::saveConfig() you'll see that it is called.

The reason it gets called is because TagEditor is a QObject subclass, which is 
indirectly descended from PlaylistSplitter (look at where m_editor is 
initialized in playlistsplitter.cpp, near line 184, and you'll be able to 
verify this by tracing the ancestry chain).

However, the children of QObjects that have not already been destroyed do not 
get destroyed until right after the parent's destructor has run, and they get 
destroyed in an essentially random order.

Your patch forces the TagEditor destructor to run at a defined point in the 
shutdown process, before the other PlaylistSplitter children have been 
deleted. Looking at $KDEHOME/share/config/jukrc after shutdown without your 
patch, the TagEditor/Show entry is definitely set to False, which I suspect is 
due to the "showEditor" action being reset during the shutdown process 
somehow, *before* the config is written out.

Your patch ensures the config is written out while all of the KActions are 
still valid, and so /does/ seem to fix the error... just not for the reason 
you think. ;)

 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-multimedia/attachments/20110429/95744a59/attachment.sig>
-------------- next part --------------
kde-multimedia mailing list
kde-multimedia at kde.org

More information about the kde-multimedia mailing list