[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#766845: abiword: crash when using formatting eye dropper



Control: tags -1 patch

This patch fixes the bug. It is based on this:

https://launchpadlibrarian.net/171169798/r33663_fix-crash-when-saving-to-pdf.patch

See also https://bugs.launchpad.net/ubuntu/+source/abiword/+bug/1204037

--- abiword-3.0.0/src/text/fmt/gtk/fv_UnixSelectionHandles.cpp	2013-04-07 13:53:03.000000000 +0000
+++ abiword-3.0.0.fix/src/text/fmt/gtk/fv_UnixSelectionHandles.cpp	2014-10-29 13:20:44.966113983 +0000
@@ -50,23 +50,32 @@
 	: FV_SelectionHandles (view, selection)
 {
 	XAP_Frame * pFrame = static_cast<XAP_Frame*>(m_pView->getParentData());
-	XAP_UnixFrameImpl * pFrameImpl =static_cast<XAP_UnixFrameImpl *>( pFrame->getFrameImpl());
-	GtkWidget * pWidget = pFrameImpl->getViewWidget();
 
-	m_text_handle = _fv_text_handle_new (pWidget);
-        _fv_text_handle_set_relative_to (m_text_handle,
-                                         gtk_widget_get_window (pWidget));
-        g_signal_connect (m_text_handle, "handle-dragged",
-                          G_CALLBACK(handle_dragged_cb), this);
+	if (pFrame) {
+		XAP_UnixFrameImpl * pFrameImpl = static_cast<XAP_UnixFrameImpl *>(pFrame->getFrameImpl());
+		GtkWidget * pWidget = pFrameImpl->getViewWidget();
+ 
+		m_text_handle = _fv_text_handle_new (pWidget);
+		_fv_text_handle_set_relative_to (m_text_handle,
+						 gtk_widget_get_window (pWidget));
+		g_signal_connect (m_text_handle, "handle-dragged",
+				  G_CALLBACK(handle_dragged_cb), this);
+	}
 }
 
 FV_UnixSelectionHandles::~FV_UnixSelectionHandles()
 {
+	if (!m_text_handle)
+		return;
+
 	g_object_unref (m_text_handle);
 }
 
 void FV_UnixSelectionHandles::hide()
 {
+	if (!m_text_handle)
+		return;
+
 	_fv_text_handle_set_mode (m_text_handle, FV_TEXT_HANDLE_MODE_NONE);
 }
 
@@ -74,6 +83,9 @@
 {
 	GdkRectangle rect;
 
+	if (!m_text_handle)
+		return;
+
 	_fv_text_handle_set_mode(m_text_handle, FV_TEXT_HANDLE_MODE_CURSOR);
 	_fv_text_handle_set_visible (m_text_handle, FV_TEXT_HANDLE_POSITION_CURSOR, visible);
 
@@ -94,6 +106,9 @@
 {
 	GdkRectangle rect;
 
+	if (!m_text_handle)
+		return;
+
 	_fv_text_handle_set_mode(m_text_handle, FV_TEXT_HANDLE_MODE_SELECTION);
 
 	_fv_text_handle_set_visible (m_text_handle, FV_TEXT_HANDLE_POSITION_SELECTION_START, start_visible);


Reply to: