Patch v3: Fix KEncodingProber crashiness
kloecker at kde.org
Sat Mar 21 13:39:39 GMT 2009
On Saturday 21 March 2009, Jeff Mitchell wrote:
> Yes, these are some issues which I didn't look at as I was just
> focused on the crash and the encoding variable. :-)
> Peter Oberndorfer wrote:
> > 4)
> > currentConfidence is set when unicodeTest detects something.
> > But the value is never used.
> > So confidence 0.0 is returned i think?
> No, the confidence returned is the confidence of the prober itself.
> currentConfidence itself is, as you surmised, never used. It's
> removed in the attached v3 patch.
> > 5)
> > I think the prober is leaked on setProberType()?
> Yes, it is. Fixed in the attached v3 patch.
I'd really like this pointer variable to be replaced by a smart pointer,
e.g. QSharedPointer. Too bad there's no Qt equivalent of the better
suited boost::scoped_ptr which doesn't do reference counting (which is
unnecessary in this case). Thiago, are there any chances for a
QScopedPointer appearing in Qt 4.6?
Manually managing resources (memory, files, etc.) is bound to cause
leaks and should therefore be avoided unless there are compelling
reasons (e.g. performance issues) not to use an object for handling a
resource. After all we are writting C++ code, so let's make use of its
features to annihilate the possibility of memory leaks.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 197 bytes
Desc: This is a digitally signed message part.
More information about the kde-core-devel