QDialog on stack+exec and dbus quit crash is no more

Albert Astals Cid aacid at kde.org
Mon Nov 11 20:22:57 GMT 2013


El Dilluns, 11 de novembre de 2013, a les 19:36:45, Kevin Krammer va escriure:
> On Monday, 2013-11-11, 19:17:22, Albert Astals Cid wrote:
> > El Diumenge, 10 de novembre de 2013, a les 15:45:42, Jan Kundrát va
> > 
> > > I've wasted my fair share of time on this in Trojita where we disconnect
> > > from the IMAP server upon seeing a network error. This, naturally, leads
> > > to
> > > freeing memory of some auxiliary objects, and that was a problem when
> > > these
> > > objects were stuck in e.g. a GUI prompt for password.
> > > 
> > > The QPointer<QDialog> indeed looks like a kludge. The right way (tm) is,
> > > AFAIK, to use asynchronous state everywhere, i.e. have dialogs connected
> > > to
> > > slots of the object which triggered them. That's also the only way to do
> > > these prompts in QML, by the way. Yup, it's more code, but it's needed,
> > > IMHO.
> > 
> > Not sure you're understanding what i say, we have an explicit check about
> > QDialog on stack+exec that says "it will crash if you dbus quit".
> 
> I was under the impression that "D-Bus triggered quit" or D-Bus interaction
> in general is just one possible cause of "something else triggers the
> parent deletion".
> 
> > What I'm saying is that this doesn't happen anymore and we should remove
> > that check. You're saying that nested event loops are bad, and that's
> > totally right, but can't see how it's related to what i said.
> 
> So we have multiple checks that recommend non-stack modal dialogs and you
> want to get rid of one of them or all duplicates of the most generic one?

Ok, now that i read the check, it is true that i may have misinterpreted the 
check as "QDialog on stack+exec and dbus quit" while the check is probably 
more something like "QDialog on stack+exec is dangerous"

And yes, i agree that "QDialog on stack+exec is dangerous" but at the moment 
the situation in a very simple program like KMines is
 * qdbus org.kde.kmines-$pid /MainApplication quit
Does not crash with QDialog on stack+exec

 * qdbus org.kde.kmines-$pid /kmines/MainWindow_1/actions/game_quit trigger
Does crash both with QDialog on stack+exec and QDialog+QPointer+exec

So adding the qpointer is not giving us much and hence my email to this 
thread, of course one can still have stuff like KParts, etc. where the thing 
makes some sense, so maybe i should just shut up and commit the patch for 
kmines?

Of course one can say that the crash in [1] is a bug that someone will fix, 
any taker?

Cheers,
  Albert

[1] http://pastebin.kde.org/polhpkf65

> 
> Cheers,
> Kevin





More information about the kde-core-devel mailing list