summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-06-07 22:27:29 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-06-07 22:28:13 +0000
commit96c7da471a5a3c771714f78db87c357873d64816 (patch)
tree01210fd886781d10d7598f82674c4c5da65d8576
parentTextToolbar: Fix superscript/subscript handling (diff)
downloadinkscape-96c7da471a5a3c771714f78db87c357873d64816.tar.gz
inkscape-96c7da471a5a3c771714f78db87c357873d64816.zip
Remove _argv0 from Inkscape::Application
Currently it was only used as the least preferred (and therefore effectively unused) location where to store the crash backup. However it wasn't set properly since 408cb49b5559a81ea803df64bf58457a5dd4bf16 causing assertion errors while crashing. On top of that argv0 is not a reliable way to determine the path to the currently running executable anyway. Fixes https://gitlab.com/inkscape/inkscape/issues/176
-rw-r--r--src/inkscape-application.cpp4
-rw-r--r--src/inkscape.cpp21
-rw-r--r--src/inkscape.h10
-rw-r--r--src/inkview-application.cpp2
-rw-r--r--src/io/resource.cpp4
-rw-r--r--testfiles/doc-per-case-test.cpp2
-rw-r--r--testfiles/fuzzer.cpp2
-rw-r--r--testfiles/src/cxxtests-to-migrate/test-helpers.h2
8 files changed, 12 insertions, 35 deletions
diff --git a/src/inkscape-application.cpp b/src/inkscape-application.cpp
index 4e31f8751..031f93bd6 100644
--- a/src/inkscape-application.cpp
+++ b/src/inkscape-application.cpp
@@ -569,7 +569,7 @@ template<>
void
ConcreteInkscapeApplication<Gio::Application>::on_startup2()
{
- Inkscape::Application::create(nullptr, false);
+ Inkscape::Application::create(false);
}
#ifdef GDK_WINDOWING_QUARTZ
@@ -582,7 +582,7 @@ void
ConcreteInkscapeApplication<Gtk::Application>::on_startup2()
{
// This should be completely rewritten.
- Inkscape::Application::create(nullptr, _with_gui); // argv appears to not be used.
+ Inkscape::Application::create(_with_gui);
if (!_with_gui) {
return;
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index 72ca329ab..984bccf6d 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -161,10 +161,10 @@ Application::operator &() const
* Creates a new Inkscape::Application global object.
*/
void
-Application::create(const char *argv0, bool use_gui)
+Application::create(bool use_gui)
{
if (!Application::exists()) {
- new Application(argv0, use_gui);
+ new Application(use_gui);
} else {
// g_assert_not_reached(); Can happen with InkscapeApplication
}
@@ -361,11 +361,6 @@ void Application::autosave_init()
}
}
-void Application::argv0(char const* argv)
-{
- _argv0 = g_strdup(argv);
-}
-
/**
* \brief Add our CSS style sheets
*/
@@ -489,7 +484,7 @@ Application::add_gtk_css()
* \pre Application::_S_inst == NULL
*/
-Application::Application(const char* argv, bool use_gui) :
+Application::Application(bool use_gui) :
_menus(nullptr),
_desktops(nullptr),
refCount(1),
@@ -509,8 +504,6 @@ Application::Application(const char* argv, bool use_gui) :
bus_handler = signal (SIGBUS, Application::crash_handler);
#endif
- _argv0 = g_strdup(argv);
-
// \TODO: this belongs to Application::init but if it isn't here
// then the Filters and Extensions menus don't work.
_S_inst = this;
@@ -603,11 +596,6 @@ Application::~Application()
_menus = nullptr;
}
- if (_argv0) {
- g_free(_argv0);
- _argv0 = nullptr;
- }
-
_S_inst = nullptr; // this will probably break things
refCount = 0;
@@ -668,7 +656,6 @@ Application::crash_handler (int /*signum*/)
gint count = 0;
gchar *curdir = g_get_current_dir(); // This one needs to be freed explicitly
- gchar *inkscapedir = g_path_get_dirname(INKSCAPE._argv0); // Needs to be freed
std::vector<gchar *> savednames;
std::vector<gchar *> failednames;
for (std::map<SPDocument*,int>::iterator iter = INKSCAPE._document_set.begin(), e = INKSCAPE._document_set.end();
@@ -714,7 +701,6 @@ Application::crash_handler (int /*signum*/)
g_get_home_dir(),
g_get_tmp_dir(),
curdir,
- inkscapedir
};
FILE *file = nullptr;
for(auto & location : locations) {
@@ -740,7 +726,6 @@ Application::crash_handler (int /*signum*/)
}
}
g_free(curdir);
- g_free(inkscapedir);
if (!savednames.empty()) {
fprintf (stderr, "\nEmergency save document locations:\n");
diff --git a/src/inkscape.h b/src/inkscape.h
index 840620171..d14420352 100644
--- a/src/inkscape.h
+++ b/src/inkscape.h
@@ -76,7 +76,7 @@ class Application {
public:
static Application& instance();
static bool exists();
- static void create(const char* argv0, bool use_gui);
+ static void create(bool use_gui);
// returns the mask of the keyboard modifier to map to Alt, zero if no mapping
// Needs to be a guint because gdktypes.h does not define a 'no-modifier' value
@@ -91,15 +91,12 @@ public:
bool use_gui() const { return _use_gui; }
void use_gui(gboolean guival) { _use_gui = guival; }
- char const* argv0() const { return _argv0; }
- void argv0(char const *);
-
// no setter for this -- only we can control this variable
static bool isCrashing() { return _crashIsHappening; }
// useful functions
void autosave_init();
- void application_init (const gchar *argv0, gboolean use_gui);
+ void application_init (gboolean use_gui);
void load_config (const gchar *filename, Inkscape::XML::Document *config, const gchar *skeleton,
unsigned int skel_size, const gchar *e_notreg, const gchar *e_notxml,
const gchar *e_notsp, const gchar *warn);
@@ -212,7 +209,7 @@ public:
private:
static Inkscape::Application * _S_inst;
- Application(const char* argv0, bool use_gui);
+ Application(bool use_gui);
~Application();
Application(Application const&); // no copy
@@ -228,7 +225,6 @@ public:
bool _dialogs_toggle;
guint _mapalt;
guint _trackalt;
- char * _argv0;
static bool _crashIsHappening;
bool _use_gui;
gint _pdf_page;
diff --git a/src/inkview-application.cpp b/src/inkview-application.cpp
index 25a96756e..f29f8b805 100644
--- a/src/inkview-application.cpp
+++ b/src/inkview-application.cpp
@@ -89,7 +89,7 @@ InkviewApplication::on_startup()
Gtk::Application::on_startup();
// Inkscape::Application should disappear!
- Inkscape::Application::create(nullptr, true); // argv appears to not be used.
+ Inkscape::Application::create(true);
}
diff --git a/src/io/resource.cpp b/src/io/resource.cpp
index 5a92096ee..078914ba0 100644
--- a/src/io/resource.cpp
+++ b/src/io/resource.cpp
@@ -457,10 +457,6 @@ char *homedir_path(const char *filename)
static const gchar *homedir = nullptr;
homedir = g_get_home_dir();
- // I suspect this is for handling inkscape app packages
- /*if (!homedir && Application::exists()) {
- homedir = g_path_get_dirname(Application::instance()._argv0);
- }*/
return g_build_filename(homedir, filename, NULL);
}
diff --git a/testfiles/doc-per-case-test.cpp b/testfiles/doc-per-case-test.cpp
index d3536ef93..0f3721ca9 100644
--- a/testfiles/doc-per-case-test.cpp
+++ b/testfiles/doc-per-case-test.cpp
@@ -26,7 +26,7 @@ void DocPerCaseTest::SetUpTestCase()
if ( !Inkscape::Application::exists() )
{
// Create the global inkscape object.
- Inkscape::Application::create("", false);
+ Inkscape::Application::create(false);
}
_doc = SPDocument::createNewDoc( NULL, TRUE, true );
diff --git a/testfiles/fuzzer.cpp b/testfiles/fuzzer.cpp
index 240a84a65..450d98c58 100644
--- a/testfiles/fuzzer.cpp
+++ b/testfiles/fuzzer.cpp
@@ -15,7 +15,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
g_type_init();
Inkscape::GC::init();
if ( !Inkscape::Application::exists() )
- Inkscape::Application::create("", false);
+ Inkscape::Application::create(false);
//void* a= sp_repr_read_mem((const char*)data, size, 0);
SPDocument *doc = SPDocument::createNewDocFromMem( (const char*)data, size, 0);
if(doc)
diff --git a/testfiles/src/cxxtests-to-migrate/test-helpers.h b/testfiles/src/cxxtests-to-migrate/test-helpers.h
index bae8ab34f..96bf5b47c 100644
--- a/testfiles/src/cxxtests-to-migrate/test-helpers.h
+++ b/testfiles/src/cxxtests-to-migrate/test-helpers.h
@@ -40,7 +40,7 @@ T* createSuiteAndDocument( void (*fun)(T*&) )
if ( !Inkscape::Application::exists() )
{
// Create the global inkscape object.
- Inkscape::Application::create("", false);
+ Inkscape::Application::create(false);
}
SPDocument* tmp = SPDocument::createNewDoc( NULL, TRUE, true );