From: joncruz Date: Wed, 21 Jan 2009 12:53:19 +0000 (+0000) Subject: Fixed to not emit signals from deleted object. May fix 271621. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=58d9f950a9fe3cb41704dda7b0ae7725af63fa14;p=inkscape.git Fixed to not emit signals from deleted object. May fix 271621. Fixed to no longer emit signal from deleted instance. Might fix bug 271621 --- diff --git a/src/document.cpp b/src/document.cpp index 5b27272c6..4f5487032 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -93,7 +93,8 @@ SPDocument::SPDocument() : router(new Avoid::Router()), perspectives(0), current_persp3d(0), - _collection_queue(0) + _collection_queue(0), + oldSignalsConnected(false) { // Don't use the Consolidate moves optimisation. router->ConsolidateMoves = false; @@ -181,8 +182,14 @@ SPDocument::~SPDocument() { modified_id = 0; } - _selection_changed_connection.disconnect(); - _desktop_activated_connection.disconnect(); + if (oldSignalsConnected) { + g_signal_handlers_disconnect_by_func(G_OBJECT(INKSCAPE), + reinterpret_cast(sp_document_reset_key), + static_cast(this)); + } else { + _selection_changed_connection.disconnect(); + _desktop_activated_connection.disconnect(); + } if (keepalive) { inkscape_unref(); @@ -385,9 +392,11 @@ sp_document_create(Inkscape::XML::Document *rdoc, G_CALLBACK(sp_document_reset_key), document); g_signal_connect(G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK(sp_document_reset_key), document); + document->oldSignalsConnected = true; } else { document->_selection_changed_connection = Inkscape::NSApplication::Editor::connectSelectionChanged (sigc::mem_fun (*document, &SPDocument::reset_key)); document->_desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::mem_fun (*document, &SPDocument::reset_key)); + document->oldSignalsConnected = false; } return document; diff --git a/src/document.h b/src/document.h index 99a887c6b..3ede5a3d0 100644 --- a/src/document.h +++ b/src/document.h @@ -110,6 +110,8 @@ struct SPDocument : public Inkscape::GC::Managed<>, GSList *_collection_queue; + bool oldSignalsConnected; + void add_persp3d (Persp3D * const persp); void remove_persp3d (Persp3D * const persp);