mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 20:45:47 +00:00
Do not give access to the actual data of the CoordCache. This prevents the use of the stored pointers which might be invalid.
See also r38011. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38012 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f4767138de
commit
4fcbb93e39
@ -52,8 +52,8 @@ void CoordCache::dump() const
|
|||||||
{
|
{
|
||||||
LYXERR0("InsetCache contains:");
|
LYXERR0("InsetCache contains:");
|
||||||
CoordCacheBase<Inset>::cache_type::const_iterator it =
|
CoordCacheBase<Inset>::cache_type::const_iterator it =
|
||||||
getInsets().getData().begin();
|
getInsets().data_.begin();
|
||||||
for (; it != getInsets().getData().end(); ++it) {
|
for (; it != getInsets().data_.end(); ++it) {
|
||||||
// Warning: it is not guaranteed that inset is a valid pointer
|
// Warning: it is not guaranteed that inset is a valid pointer
|
||||||
// (therefore it has type 'void *') (see bug #7376).
|
// (therefore it has type 'void *') (see bug #7376).
|
||||||
void const * inset = it->first;
|
void const * inset = it->first;
|
||||||
|
@ -161,9 +161,6 @@ private:
|
|||||||
|
|
||||||
typedef std::map<T const *, Geometry> cache_type;
|
typedef std::map<T const *, Geometry> cache_type;
|
||||||
cache_type data_;
|
cache_type data_;
|
||||||
|
|
||||||
public:
|
|
||||||
cache_type const & getData() const { return data_; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,20 +95,18 @@ DocIterator bruteFind2(Cursor const & c, int x, int y)
|
|||||||
int xo;
|
int xo;
|
||||||
int yo;
|
int yo;
|
||||||
Inset const * inset = &it.inset();
|
Inset const * inset = &it.inset();
|
||||||
map<Inset const *, Geometry> const & data =
|
CoordCache const & cache = c.bv().coordCache();
|
||||||
c.bv().coordCache().getInsets().getData();
|
|
||||||
map<Inset const *, Geometry>::const_iterator I = data.find(inset);
|
|
||||||
|
|
||||||
// FIXME: in the case where the inset is not in the cache, this
|
// FIXME: in the case where the inset is not in the cache, this
|
||||||
// means that no part of it is visible on screen. In this case
|
// means that no part of it is visible on screen. In this case
|
||||||
// we don't do elaborate search and we just return the forwarded
|
// we don't do elaborate search and we just return the forwarded
|
||||||
// DocIterator at its beginning.
|
// DocIterator at its beginning.
|
||||||
if (I == data.end()) {
|
if (!cache.getInsets().has(inset)) {
|
||||||
it.top().pos() = 0;
|
it.top().pos() = 0;
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point o = I->second.pos;
|
Point const o = cache.getInsets().xy(inset);
|
||||||
inset->cursorPos(c.bv(), it.top(), c.boundary(), xo, yo);
|
inset->cursorPos(c.bv(), it.top(), c.boundary(), xo, yo);
|
||||||
// Convert to absolute
|
// Convert to absolute
|
||||||
xo += o.x_;
|
xo += o.x_;
|
||||||
|
Loading…
Reference in New Issue
Block a user