summaryrefslogtreecommitdiffstats
path: root/src/extension/extension.cpp
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-10-15 18:03:44 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-10-15 21:56:31 +0000
commit5e4db64162efe64935c2f4a1b4525ff14c42b91d (patch)
tree998aebed100549fe5b27491f948a3375daf66e1a /src/extension/extension.cpp
parentAdd checkboxes in flip menu options (diff)
downloadinkscape-5e4db64162efe64935c2f4a1b4525ff14c42b91d.tar.gz
inkscape-5e4db64162efe64935c2f4a1b4525ff14c42b91d.zip
Extensions: Do not even attempt to register incompatible extensions
This improves the fix for https://bugs.launchpad.net/inkscape/+bug/1307554 Also fixes a potential crashing issue when an .inx includes invalid XML.
Diffstat (limited to 'src/extension/extension.cpp')
-rw-r--r--src/extension/extension.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp
index fedd0facc..2c5f6a978 100644
--- a/src/extension/extension.cpp
+++ b/src/extension/extension.cpp
@@ -146,13 +146,22 @@ Extension::Extension(Inkscape::XML::Node *in_repr, Implementation::Implementatio
child_repr = child_repr->next();
}
- // register extension if we have an id and a name
+ // all extensions need an ID and a name
if (!_id) {
throw extension_no_id();
}
if (!_name) {
throw extension_no_name();
}
+
+ // filter out extensions that are not compatible with the current platform
+#ifndef _WIN32
+ if (strstr(_id, "win32")) {
+ throw extension_not_compatible();
+ }
+#endif
+
+ // finally register the extension if all checks passed
db.register_ext (this);
}
@@ -287,17 +296,6 @@ Extension::check ()
const char * inx_failure = _(" This is caused by an improper .inx file for this extension."
" An improper .inx file could have been caused by a faulty installation of Inkscape.");
- // No need to include Windows only extensions
- // See LP bug #1307554 for details - https://bugs.launchpad.net/inkscape/+bug/1307554
-#ifndef _WIN32
- const char* win_ext[] = {"com.vaxxine.print.win32"};
- std::vector<std::string> v (win_ext, win_ext + sizeof(win_ext)/sizeof(win_ext[0]));
- std::string ext_id(_id);
- if (std::find(v.begin(), v.end(), ext_id) != v.end()) {
- printFailure(Glib::ustring(_("the extension is designed for Windows only.")) + inx_failure);
- retval = false;
- }
-#endif
if (repr == nullptr) {
printFailure(Glib::ustring(_("the XML description of it got lost.")) + inx_failure);
retval = false;