summaryrefslogtreecommitdiffstats
path: root/src/text-context.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2006-09-12 18:05:28 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2006-09-12 18:05:28 +0000
commitabd1fe231f6da5d392e6381b044aec4613f22a8f (patch)
tree1aae7fa17c5296bf31c520dbb3359bf045821872 /src/text-context.cpp
parentdisconnect mask/ref connections when item is destroyed (diff)
downloadinkscape-abd1fe231f6da5d392e6381b044aec4613f22a8f.tar.gz
inkscape-abd1fe231f6da5d392e6381b044aec4613f22a8f.zip
fix crash when a cursor/selection update comes after a display update which was interrupted with destroying the text context
(bzr r1700)
Diffstat (limited to 'src/text-context.cpp')
-rw-r--r--src/text-context.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/text-context.cpp b/src/text-context.cpp
index 1185e08ef..26c6b42d7 100644
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
@@ -297,6 +297,10 @@ sp_text_context_finish(SPEventContext *ec)
{
SPTextContext *tc = SP_TEXT_CONTEXT(ec);
+ if (ec->desktop) {
+ sp_signal_disconnect_by_data(sp_desktop_canvas(ec->desktop), tc);
+ }
+
ec->enableGrDrag(false);
tc->style_set_connection.disconnect();
@@ -337,10 +341,6 @@ sp_text_context_finish(SPEventContext *ec)
gtk_object_destroy(*it);
}
tc->text_selection_quads.clear();
-
- if (ec->desktop) {
- sp_signal_disconnect_by_data(sp_desktop_canvas(ec->desktop), tc);
- }
}
@@ -1441,6 +1441,10 @@ sp_text_context_update_cursor(SPTextContext *tc, bool scroll_to_see)
{
GdkRectangle im_cursor = { 0, 0, 1, 1 };
+ // due to interruptible display, tc may already be destroyed during a display update before
+ // the cursor update (can't do both atomically, alas)
+ if (!tc->desktop) return;
+
if (tc->text) {
NR::Point p0, p1;
sp_te_get_cursor_coords(tc->text, tc->text_sel_end, p0, p1);
@@ -1494,6 +1498,10 @@ sp_text_context_update_cursor(SPTextContext *tc, bool scroll_to_see)
static void sp_text_context_update_text_selection(SPTextContext *tc)
{
+ // due to interruptible display, tc may already be destroyed during a display update before
+ // the selection update (can't do both atomically, alas)
+ if (!tc->desktop) return;
+
for (std::vector<SPCanvasItem*>::iterator it = tc->text_selection_quads.begin() ; it != tc->text_selection_quads.end() ; it++) {
sp_canvas_item_hide(*it);
gtk_object_destroy(*it);