[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Not used QPointers showing modal dialogs via exec() - No crash
From: Kevin Krammer <krammer () kde ! org>
Date: 2013-11-11 18:42:13
Message-ID: 1412976.LvCQpxmoBr () persephone
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
On Monday, 2013-11-11, 15:53:15, Daniel Nicoletti wrote:
> This check is to prevent issues, if someone in the future changes
> the code to do something after exec() then it's very likely to
> crash due to the caller or it's child stuff already being deleted.
> If you don't do anything after exec() and the function was called
> by the event loop you are probably safe.
I think you can also run into that problem if there is nothing after exec().
If anything, D-Bus, timer, whatever, causes deletion of the dialog's parent,
in this case KMinesMainWindow, then it will delete its child QObject.
When the C++ code of the functions cleans up the stack, it will at least also
invoke the dialog's destructor.
Cheers,
Kevin
>
> 2013/11/11 Harsh Kumar <harsh1kumar@gmail.com>:
> > Hi,
> >
> > I have a question:
> >
> > Krazy2 flags this issue in KMines - Not using QPointers when showing
> > modal dialogs via exec()
> > See: http://ebn.kde.org/krazy/reports/kde-4.x/kdegames/kmines/index.html
> >
> > Following is the function to display High Scores dialog where the
> > problem has been flagged:
> >
> > void KMinesMainWindow::showHighscores()
> > {
> >
> > KScoreDialog scoreDialog(KScoreDialog::Name | KScoreDialog::Time,
> > this);
> > scoreDialog.initFromDifficulty(Kg::difficulty());
> > scoreDialog.hideField(KScoreDialog::Score);
> > scoreDialog.exec();
> >
> > }
> >
> > KMines should crash when High Score dialog is open & application is
> > closed using dbus.
> >
> > So, I did the following:
> > 1.) Started KMines
> > 2.) Opened the High Scores dialog
> > 3.) Ran the command -
> >
> > qdbus org.kde.kmines-[pid] /MainApplication quit
> >
> > KMines exits without any crash. It seems nothing went wrong.
> >
> > What can be the reason for this? Why am I not able to reproduce the crash.
> >
> > Thanks
> > Regards
> > Harsh Kumar
> >
> >>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> >>> unsubscribe <<>>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe
> >> <<
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
["signature.asc" (application/pgp-signature)]
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic