[PATCH] KReplace - Prompt on replace broken

David Faure faure at kde.org
Fri Nov 9 12:41:17 CET 2007


On Thursday 08 November 2007, Thomas McGuire wrote:
> Hi,
> 
> KReplace is broken for me, the prompt on replace dialog is never shown, 
> because it has size 0.
> 
> To reproduce:
> 1. Open Konqueor on dot.kde.org, go to some story, and reply.
> 2. Enter "asdf" in the comment area
> 3. Right-click, then "Replace"
> 4. Text to find: "asdf". Make sure "Prompt on replace" is checked
> 5. You now should see a prompt dialog (Close/Replace/Skip/Cancel), but you 
> don't, because that dialog has size 0 and is therefore invisible
> 
> The reason is resize(minimumSize()) in 
> KReplaceNextDialog::KReplaceNextDialog(). minimumSize() here returns 0.

Indeed I get 0x0 for minimumSize here too. But I stepped into that resize() call
and qwidget_x11.cpp says:
2115            if (w == 0 || h == 0) {
2116                q->setAttribute(Qt::WA_OutsideWSRange, true);  // we get there
2117                if (q->isVisible() && q->testAttribute(Qt::WA_Mapped))
2118                    hide_sys(); // we don't get there
and the show() call goes into QDialog::setVisible(true) which shows it with
(gdb) p rect()
$18 = {x1 = 0, y1 = 0, x2 = 368, y2 = 81}


But yeah, I agree that asking for minimumSize() makes no sense. The one who wrote
this forgot that
 - minimumSizeHint/sizeHint is what the _widget_ thinks
 - mimumSize/maximumSize/fixedSize is what the _user_ of the widget thinks.
And in this case the user code didn't set anything so minimumSize is obviously 0x0.

Hmm, the author might have been me, it seems. Oh well, I was young and inexperienced :-)

> The attached patch simpy removes the line with resize().
Please commit.

> With this fix, Konqueror still crashes when the prompt dialog is closed 
> though, from the backtrace it seems because some receiver, which is about the 
> get a signal, is 0. I didn't really try to fix the problem, but I found out 
> that commenting out delete m_replace; m_replace = 0; in 
> khtml/rendering/render_form.cpp:1587 works around the problem. I guess the 
> real problem is in KHTML, not KReplace, but I'm not sure.
I fixed this one just now.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).


More information about the Kdelibs-bugs mailing list