summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f53c4ac)
raw | patch | inline | side by side (parent: f53c4ac)
author | gouldtj <gouldtj@users.sourceforge.net> | |
Sat, 1 Sep 2007 04:33:48 +0000 (04:33 +0000) | ||
committer | gouldtj <gouldtj@users.sourceforge.net> | |
Sat, 1 Sep 2007 04:33:48 +0000 (04:33 +0000) |
Fixed a tricky segmentation fault. Multithreading is hard when you
don't have threads :)
don't have threads :)
src/extension/execution-env.cpp | patch | blob | history | |
src/extension/execution-env.h | patch | blob | history | |
src/extension/prefdialog.cpp | patch | blob | history |
index fcf60cdcbb3f6d8a61dff054ac3a675b3186fc4b..88cd1af7df30bef1cf00ce804dc64608702f7a90 100644 (file)
ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Gtk::Widget * controls, Gtk::Dialog * prefDialog) :
- _effect(effect),
_visibleDialog(NULL),
+ _effect(effect),
_prefsVisible(false),
_finished(false),
_humanWait(false),
_canceled(false),
_prefsChanged(false),
_livePreview(true),
+ _selfdelete(false),
_doc(doc) {
SPDesktop *desktop = (SPDesktop *)_doc;
Glib::ustring selected_id;
selected_id = SP_OBJECT_ID(*selected);
_selected.insert(_selected.end(), selected_id);
- //std::cout << "Selected: " << selected_id << std::endl;
+ std::cout << "Selected: " << selected_id << std::endl;
++selected;
}
}
void
ExecutionEnv::createWorkingDialog (void) {
- printf("Create working dialog\n");
+ printf("Create working dialog. doc: %X\n", _doc);
if (_visibleDialog != NULL) {
delete _visibleDialog;
}
void
ExecutionEnv::reselect (void) {
+ printf("A doc: %X\n", _doc);
+ if (_doc == NULL) { return; }
SPDocument * doc = _doc->doc();
+ if (doc == NULL) { return; }
+ printf("B doc: %X\n", _doc);
SPDesktop *desktop = (SPDesktop *)_doc;
sp_namedview_document_from_window(desktop);
if (desktop == NULL) { return; }
+ printf("C doc: %X\n", _doc);
Inkscape::Selection * selection = sp_desktop_selection(desktop);
+ printf("D doc: %X\n", _doc);
for (std::list<Glib::ustring>::iterator i = _selected.begin(); i != _selected.end(); i++) {
- selection->add(doc->getObjectById(i->c_str()));
+ printf("E %s doc: %X\n", i->c_str(), _doc);
+ SPObject * obj = doc->getObjectById(i->c_str());
+ printf("F %s doc: %X\n", i->c_str(), _doc);
+ if (obj != NULL) {
+ selection->add(obj);
+ }
}
return;
processingComplete();
}
if (_canceled) {
+ printf("Canceling the document doc: %X\n", _doc);
sp_document_cancel(_doc->doc());
+ printf("Reselecting doc: %X\n", _doc);
reselect();
}
}
printf("Execution environment done running\n");
+ if (_selfdelete) {
+ delete this;
+ }
return;
}
}
void
-ExecutionEnv::shutdown (void) {
- _mainloop->quit();
- processingCancel();
+ExecutionEnv::shutdown (bool del) {
+ printf("Shutting down Execution Environment\n");
+ if (_humanWait) {
+ _mainloop->quit();
+ } else {
+ processingCancel();
+ }
documentCancel();
+
_finished = true;
_visibleDialog = NULL;
}
+ _selfdelete = del;
return;
}
index a3938be3d3c608742ae726cd932b715c14fa733b..5758658f32662a19c6806dbe71672ce2bc69fdc4 100644 (file)
bool _canceled;
bool _prefsChanged;
bool _livePreview;
+ bool _selfdelete;
Glib::RefPtr<Glib::MainLoop> _mainloop;
Inkscape::UI::View::View * _doc;
std::list<Glib::ustring> _selected;
void run (void);
void preferencesChange (void);
void livePreview (bool state = true);
- void shutdown (void);
+ void shutdown (bool del = false);
private:
void createPrefsDialog (Gtk::Widget * controls);
index 62e6b9ff8965515ac5631be03dc4e12dfc3da96a..4676661b17273c8cab58ab3eb2a88aa7066ab1fa 100644 (file)
_button_cancel->set_label(Gtk::Stock::CLOSE.id);
if (_exEnv != NULL) {
- _exEnv->shutdown();
- if (_createdExEnv) {
- delete _exEnv;
- }
+ _exEnv->shutdown(_createdExEnv);
_exEnv = NULL;
}
} else {