+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
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();
+ }
}
}
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
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);