mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
fix memory access bugs in flimage use.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3682 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ff8f704031
commit
1ce24386f2
@ -1,3 +1,10 @@
|
||||
2002-03-07 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* xformsGImage.C (statusCB, errorCB): close the file streams once the
|
||||
image is loaded or if an error occurs.
|
||||
(init_graphics): FLIMAGE_SETUP setup must be static as xforms stores
|
||||
it permanently (and does not make a copy!).
|
||||
|
||||
2002-03-05 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* xformsGImage.[Ch]: new files. An image loader based on xforms library
|
||||
|
@ -308,8 +308,14 @@ void xformsGImage::statusCB(string const & status_message)
|
||||
return;
|
||||
|
||||
if (prefixIs(status_message, "Done Reading")) {
|
||||
on_finish_->emit(true);
|
||||
on_finish_.reset();
|
||||
if (image_) {
|
||||
flimage_close(image_);
|
||||
}
|
||||
|
||||
if (on_finish_.get()) {
|
||||
on_finish_->emit(true);
|
||||
on_finish_.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,8 +325,14 @@ void xformsGImage::errorCB(string const & error_message)
|
||||
if (error_message.empty() || !on_finish_.get())
|
||||
return;
|
||||
|
||||
on_finish_->emit(false);
|
||||
on_finish_.reset();
|
||||
if (image_) {
|
||||
flimage_close(image_);
|
||||
}
|
||||
|
||||
if (on_finish_.get()) {
|
||||
on_finish_->emit(false);
|
||||
on_finish_.reset();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace grfx
|
||||
@ -398,7 +410,9 @@ void init_graphics()
|
||||
flimage_enable_xwd();
|
||||
flimage_enable_xpm();
|
||||
|
||||
FLIMAGE_SETUP setup;
|
||||
// xforms stores this permanently (does not make a copy) so
|
||||
// this should never be destroyed.
|
||||
static FLIMAGE_SETUP setup;
|
||||
setup.visual_cue = status_report;
|
||||
setup.error_message = error_report;
|
||||
flimage_setup(&setup);
|
||||
|
Loading…
Reference in New Issue
Block a user