mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Fixed possible crash when reinitializing LyXText!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2496 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4a2096fff1
commit
f5394fd982
@ -1,5 +1,9 @@
|
|||||||
2001-08-13 Juergen Vigna <jug@sad.it>
|
2001-08-13 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* insettext.C: fixed problem when reinitializing LyXText by not doing
|
||||||
|
it while lt is in use and post this to the next possible time in
|
||||||
|
getLyXText().
|
||||||
|
|
||||||
* insetert.C (InsetERT): init status_ also in the 3rd constructor.
|
* insetert.C (InsetERT): init status_ also in the 3rd constructor.
|
||||||
|
|
||||||
* insettabular.C (tabularFeatures): fixed fix where deleting the
|
* insettabular.C (tabularFeatures): fixed fix where deleting the
|
||||||
|
@ -129,7 +129,8 @@ InsetText::InnerCache::InnerCache(boost::shared_ptr<LyXText> t)
|
|||||||
|
|
||||||
|
|
||||||
InsetText::InsetText()
|
InsetText::InsetText()
|
||||||
: UpdatableInset(), lt(0), in_update(false)
|
: UpdatableInset(), lt(0), in_update(false), do_resize(0),
|
||||||
|
do_reinit(false)
|
||||||
{
|
{
|
||||||
par = new Paragraph;
|
par = new Paragraph;
|
||||||
init();
|
init();
|
||||||
@ -137,7 +138,8 @@ InsetText::InsetText()
|
|||||||
|
|
||||||
|
|
||||||
InsetText::InsetText(InsetText const & in, bool same_id)
|
InsetText::InsetText(InsetText const & in, bool same_id)
|
||||||
: UpdatableInset(in, same_id), lt(0), in_update(false)
|
: UpdatableInset(in, same_id), lt(0), in_update(false), do_resize(0),
|
||||||
|
do_reinit(false)
|
||||||
{
|
{
|
||||||
par = 0;
|
par = 0;
|
||||||
init(&in, same_id);
|
init(&in, same_id);
|
||||||
@ -1863,6 +1865,10 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
|
|||||||
Cache::iterator it = cache.find(bv);
|
Cache::iterator it = cache.find(bv);
|
||||||
|
|
||||||
if (it != cache.end()) {
|
if (it != cache.end()) {
|
||||||
|
if (do_reinit)
|
||||||
|
reinitLyXText();
|
||||||
|
else if (do_resize)
|
||||||
|
resizeLyXText(do_resize);
|
||||||
if (lt || !it->second.remove) {
|
if (lt || !it->second.remove) {
|
||||||
lyx::Assert(it->second.text.get());
|
lyx::Assert(it->second.text.get());
|
||||||
cached_text = it->second.text;
|
cached_text = it->second.text;
|
||||||
@ -1917,6 +1923,13 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
|
|||||||
|
|
||||||
void InsetText::resizeLyXText(BufferView * bv, bool force) const
|
void InsetText::resizeLyXText(BufferView * bv, bool force) const
|
||||||
{
|
{
|
||||||
|
if (lt) {
|
||||||
|
// we cannot resize this because we are in use!
|
||||||
|
// so do this on the next possible getLyXText()
|
||||||
|
do_resize = bv;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
do_resize = false;
|
||||||
// lyxerr << "InsetText::resizeLyXText\n";
|
// lyxerr << "InsetText::resizeLyXText\n";
|
||||||
if (!par->next() && !par->size()) // no data, resize not neccessary!
|
if (!par->next() && !par->size()) // no data, resize not neccessary!
|
||||||
return;
|
return;
|
||||||
@ -1957,6 +1970,14 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
|
|||||||
|
|
||||||
void InsetText::reinitLyXText() const
|
void InsetText::reinitLyXText() const
|
||||||
{
|
{
|
||||||
|
if (lt) {
|
||||||
|
// we cannot resize this because we are in use!
|
||||||
|
// so do this on the next possible getLyXText()
|
||||||
|
do_reinit = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
do_reinit = false;
|
||||||
|
do_resize = false;
|
||||||
// lyxerr << "InsetText::reinitLyXText\n";
|
// lyxerr << "InsetText::reinitLyXText\n";
|
||||||
for(Cache::iterator it = cache.begin(); it != cache.end(); ++it) {
|
for(Cache::iterator it = cache.begin(); it != cache.end(); ++it) {
|
||||||
lyx::Assert(it->second.text.get());
|
lyx::Assert(it->second.text.get());
|
||||||
|
@ -397,5 +397,7 @@ private:
|
|||||||
mutable int frame_h;
|
mutable int frame_h;
|
||||||
///
|
///
|
||||||
bool in_update; /* as update is not reentrant! */
|
bool in_update; /* as update is not reentrant! */
|
||||||
|
mutable BufferView * do_resize;
|
||||||
|
mutable bool do_reinit;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user