aspell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[aspell-devel] Saving pointers to std::vector data


From: Gary Setter
Subject: [aspell-devel] Saving pointers to std::vector data
Date: Sat, 27 Aug 2005 19:47:05 -0500

Hi,
I had a problem with Borland BCB 5.5 version of aspell. It was
going into an infinite loop. This happend when building the list
suggestions.  I could reproduce the problem by creating a
replacement dictionary where one misspelled word had two
corrections, and checking a document that had that misspelled
word. The root cause seemed to be how pointers to replacement
dictionary data, in particular the vector that holds the
corrections.

Notice that struct WordEntry contains an array of three points
to void which are used by the various dictionary types in various
way. See Writable.cpp functions repl_init and repl_next. They are
static functions that store/retrieve replace data, including the
pointer to the  vector of corrections, as voids.

Between the time the pointers are stored and are used, the
data is 'corrupted'. The result was first some strange
suggestions and then a lockup.

I changed the WritableReplDict::repl_lookup() function to lookup
the supplied word in the dictionaries table and return the vector
of replacements, rather then return the pointer stored earlier in
a WordEntry object. This corrected my problem.

My recollection is that the addresses of object in standard
template library container object are not guaranteed to stay
valid. The
class is suppose to be able to reallocate memory as it needs to.
Can anyone here back me up on this?

My plan is to continue looking into this and I may submit a
patch that eliminates the WordEntry intr field and replaces it
with code that retrieves the data more directly. How I continue
will be effected by your comments.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]