summaryrefslogtreecommitdiffstats
path: root/src/extension
diff options
context:
space:
mode:
authorMark Harmer <drivehappy@gmail.com>2015-04-27 16:01:19 +0000
committerJosh Andler <scislac@gmail.com>2015-04-27 16:01:19 +0000
commitf20da2a7a6e65bcf3a907c3ee5cb5fd69a71c867 (patch)
tree95b47df93c793689ec37e14384f82f7d21772774 /src/extension
parentextensions. ink2canvas.py - do not parse html comments. (Bug 1446204) (diff)
downloadinkscape-f20da2a7a6e65bcf3a907c3ee5cb5fd69a71c867.tar.gz
inkscape-f20da2a7a6e65bcf3a907c3ee5cb5fd69a71c867.zip
Mainloop fix for possible data loss if closing before save has completed.
Fixed bugs: - https://launchpad.net/bugs/967416 (bzr r14060)
Diffstat (limited to 'src/extension')
-rw-r--r--src/extension/implementation/script.cpp5
-rw-r--r--src/extension/implementation/script.h2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index bbc567f75..52c360fcd 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -1027,7 +1027,10 @@ int Script::execute (const std::list<std::string> &in_command,
return 0;
}
- _main_loop = Glib::MainLoop::create(false);
+ // Create a new MainContext for the loop so that the original context sources are not run here,
+ // this enforces that only the file_listeners should be read in this new MainLoop
+ Glib::RefPtr<Glib::MainContext> _main_context = Glib::MainContext::create();
+ _main_loop = Glib::MainLoop::create(_main_context, false);
file_listener fileerr;
fileout.init(stdout_pipe, _main_loop);
diff --git a/src/extension/implementation/script.h b/src/extension/implementation/script.h
index 6a7d0c3b8..4cf33c989 100644
--- a/src/extension/implementation/script.h
+++ b/src/extension/implementation/script.h
@@ -90,7 +90,7 @@ private:
void init (int fd, Glib::RefPtr<Glib::MainLoop> main) {
_channel = Glib::IOChannel::create_from_fd(fd);
_channel->set_encoding();
- _conn = Glib::signal_io().connect(sigc::mem_fun(*this, &file_listener::read), _channel, Glib::IO_IN | Glib::IO_HUP | Glib::IO_ERR);
+ _conn = main->get_context()->signal_io().connect(sigc::mem_fun(*this, &file_listener::read), _channel, Glib::IO_IN | Glib::IO_HUP | Glib::IO_ERR);
_main_loop = main;
return;