diff --git a/src/gfx/generated_image.hpp b/src/gfx/generated_image.hpp index a28c3174..e4e242dd 100644 --- a/src/gfx/generated_image.hpp +++ b/src/gfx/generated_image.hpp @@ -45,7 +45,7 @@ class GeneratedImage : public ScriptValue { /// Equality should mean that every pixel in the generated images is the same if the same options are used virtual bool operator == (const GeneratedImage& that) const = 0; inline bool operator != (const GeneratedImage& that) const { return !(*this == that); } - + /// Can this image be generated safely from another thread? virtual bool threadSafe() const = 0; @@ -64,8 +64,8 @@ class LinearBlendImage : public GeneratedImage { virtual Image generate(const Options& opt) const; virtual ImageCombine combine() const; virtual bool operator == (const GeneratedImage& that) const; - - virtual bool threadSafe() const {return true;} + + virtual bool threadSafe() const { return true; } private: GeneratedImageP image1, image2; double x1, y1, x2, y2; @@ -82,8 +82,8 @@ class MaskedBlendImage : public GeneratedImage { virtual Image generate(const Options& opt) const; virtual ImageCombine combine() const; virtual bool operator == (const GeneratedImage& that) const; - - virtual bool threadSafe() const {return true;} + + virtual bool threadSafe() const { return true; } private: GeneratedImageP light, dark, mask; }; @@ -99,8 +99,8 @@ class CombineBlendImage : public GeneratedImage { virtual Image generate(const Options& opt) const; virtual ImageCombine combine() const; virtual bool operator == (const GeneratedImage& that) const; - - virtual bool threadSafe() const {return true;} + + virtual bool threadSafe() const { return true; } private: GeneratedImageP image1, image2; ImageCombine image_combine; @@ -117,8 +117,8 @@ class SetMaskImage : public GeneratedImage { virtual Image generate(const Options& opt) const; virtual ImageCombine combine() const; virtual bool operator == (const GeneratedImage& that) const; - - virtual bool threadSafe() const {return true;} + + virtual bool threadSafe() const { return true; } private: GeneratedImageP image, mask; }; @@ -151,8 +151,8 @@ class PackagedImage : public GeneratedImage { {} virtual Image generate(const Options& opt) const; virtual bool operator == (const GeneratedImage& that) const; - - virtual bool threadSafe() const {return true;} + + virtual bool threadSafe() const { return true; } private: String filename; }; @@ -167,8 +167,8 @@ class BuiltInImage : public GeneratedImage { {} virtual Image generate(const Options& opt) const; virtual bool operator == (const GeneratedImage& that) const; - - virtual bool threadSafe() const {return true;} + + virtual bool threadSafe() const { return true; } private: String name; }; @@ -182,8 +182,12 @@ class SymbolToImage : public GeneratedImage { ~SymbolToImage(); virtual Image generate(const Options& opt) const; virtual bool operator == (const GeneratedImage& that) const; - - virtual bool threadSafe() const {return false;} + + #ifdef __WXGTK__ + virtual bool threadSafe() const { return false; } + #else + virtual bool threadSafe() const { return true; } + #endif private: SymbolToImage(const SymbolToImage&); // copy ctor String filename; diff --git a/src/gui/new_window.cpp b/src/gui/new_window.cpp index 9c0c3eb7..fb5b5fe7 100644 --- a/src/gui/new_window.cpp +++ b/src/gui/new_window.cpp @@ -92,13 +92,13 @@ void NewSetWindow::OnOK(wxCommandEvent&) { void NewSetWindow::done() { try { - StyleSheetP stylesheet = stylesheet_list->getSelection(); - set = new_intrusive1(stylesheet); - set->validate(); - EndModal(wxID_OK); - } catch (Error& e) { - handle_error(e); - throw; // We want to crash. + StyleSheetP stylesheet = stylesheet_list->getSelection(); + set = new_intrusive1(stylesheet); + set->validate(); + EndModal(wxID_OK); + } catch (const Error& e) { + handle_error(e); + EndModal(wxID_CANCEL); } } diff --git a/src/gui/set/window.cpp b/src/gui/set/window.cpp index 4d59dc60..125635b8 100644 --- a/src/gui/set/window.cpp +++ b/src/gui/set/window.cpp @@ -173,8 +173,6 @@ SetWindow::~SetWindow() { delete find_dialog; // remove from list of set windows set_windows.erase(remove(set_windows.begin(), set_windows.end(), this)); - // stop updating - onBeforeChangeSet(); } // ----------------------------------------------------------------------------- : Panel managment diff --git a/src/script/image.hpp b/src/script/image.hpp index 9060bf55..0493073c 100644 --- a/src/script/image.hpp +++ b/src/script/image.hpp @@ -47,7 +47,7 @@ class ScriptableImage { } /// Can this be safely generated from another thread? - bool threadSafe() const {return value != nullptr ? value->threadSafe() : false; } + inline bool threadSafe() const { return !value || value->threadSafe(); } private: OptionalScript script; ///< The script, not really optional