Bug 166029 - Replace in spell dialog closes dialog
Summary: Replace in spell dialog closes dialog
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdeui (show other bugs)
Version: SVN
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-08 12:40 UTC by Alan Braslau
Modified: 2008-07-08 19:49 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Braslau 2008-07-08 12:41:16 UTC
Version:           1.9.52 (using 4.00.84 (KDE 4.0.84 (KDE 4.1 >= 20080625), Debian packages)
Compiler:          cc
OS:                Linux (i686) release 2.6.25

Selecting "replace" in the kmail composer spelling dialog closes the spelling check window. I believe that it should stay open until the end of the message is reached or the "finished" button is selected.
Comment 1 Thomas McGuire 2008-07-08 16:09:58 UTC
Yes, confirmed.
The spell dialog is in kdelibs (happens also in Konqueror for example), so reassigning this bug to there.
Comment 2 Tobias Koenig 2008-07-08 16:45:06 UTC
That's a bug how KTextEditor is using the replace dialog I guess, since
replacing text in kwrite works fine.
Comment 3 Thomas McGuire 2008-07-08 17:00:29 UTC
> That's a bug how KTextEditor is using the replace dialog I guess, since
> replacing text in kwrite works fine.

Hmm, I think this is a problem in KTextEdit / the spell dialog, but not 
KTextEditor (which is something Kate-related).

And it's not a problem with the normal replace dialog (that works), but with 
the replace function in the spell check dialog, which replaces a misspelled 
word with the correct one.
Comment 4 Tobias Koenig 2008-07-08 17:06:52 UTC
Yeah, meant KTextEdit (without 'or' ;)).

The problem only appears if autospellchecking is enabled in KTextEdit.
I can't see any problematic code though, maybe the Sonnect::Highlighter::eventFilter()
handling?

Ciao,
Tobias
Comment 5 Tobias Koenig 2008-07-08 18:31:44 UTC
On Tue, Jul 08, 2008 at 03:06:53PM -0000, Tobias Koenig wrote:
Hej,

> The problem only appears if autospellchecking is enabled in KTextEdit.
> I can't see any problematic code though, maybe the Sonnect::Highlighter::eventFilter()
> handling?

A bit of investigation shows, that the culprit part is Sonnet::Filter.
Its static instance is used by both, the BackgroundChecker of the dialog
and the BackgroundChecker of the Highlighter, so the highlighters
changes the state of the global filter instance and the dialog thinks it
is already finish with checking and closes itself.

Creating a new Filter in every BackgroundEngine instance solves that
problem here.

@Zack What's the best way to fix it?

Ciao,
Tobias
Comment 6 Zack Rusin 2008-07-08 19:05:19 UTC
On Tuesday 08 July 2008 12:32:37 pm Tobias Koenig wrote:
> On Tue, Jul 08, 2008 at 03:06:53PM -0000, Tobias Koenig wrote:
> Hej,
>
> > The problem only appears if autospellchecking is enabled in KTextEdit.
> > I can't see any problematic code though, maybe the
> > Sonnect::Highlighter::eventFilter() handling?
>
> A bit of investigation shows, that the culprit part is Sonnet::Filter.
> Its static instance is used by both, the BackgroundChecker of the dialog
> and the BackgroundChecker of the Highlighter, so the highlighters
> changes the state of the global filter instance and the dialog thinks it
> is already finish with checking and closes itself.
>
> Creating a new Filter in every BackgroundEngine instance solves that
> problem here.
>
> @Zack What's the best way to fix it?


If I'd be after a quick fix I'd probably change Filter* 
Filter::defaultFilter() to look like:
Filter* Filter::defaultFilter()
{
	return new Filter;
}
instead of 
Filter* Filter::defaultFilter()
{
	return s_defFilter;
}
this way filters created by Filter::defaultFilter will have to be deleteted so 
some delete in backgroundengine would be also nice, but it should fix this 
bug.

If I'd be after a longer but proper solution I'd replace Sonnet::Filter with 
QTextBoundaryFinder.

z
Comment 7 Tobias Koenig 2008-07-08 19:49:14 UTC
SVN commit 829603 by tokoe:

Do not use a static filter, as that will cause trouble if
more than one backgroundchecker is in action (e.g. highlighter + spellchecking dialog)

BUG: 166029


 M  +1 -0      backgroundengine.cpp  
 M  +1 -1      filter.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=829603