[gimp/gimp-2-6] Bug 627328 - GIMP 2.6.10 segfaults when CTRL-left click on a layer mask
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-6] Bug 627328 - GIMP 2.6.10 segfaults when CTRL-left click on a layer mask
- Date: Sun, 10 Oct 2010 20:36:05 +0000 (UTC)
commit b23d1635cd435790bffcf50bbff5753d34c9ff97
Author: Christian Krippendorf <Kontakt-Programming CerebrosuS de>
Date: Sun Oct 10 22:31:35 2010 +0200
Bug 627328 - GIMP 2.6.10 segfaults when CTRL-left click on a layer mask
Move the g_signal_emit() to the end, because the cell->renderer could
be changed and cause a segfault. Also check cell->renderer before
dereferencing it.
(cherry picked from commit ff03681bdfa371891ec7cc754bfed811c5c434e6)
app/widgets/gimpcellrendererviewable.c | 41 ++++++++++++++++++--------------
1 files changed, 23 insertions(+), 18 deletions(-)
---
diff --git a/app/widgets/gimpcellrendererviewable.c b/app/widgets/gimpcellrendererviewable.c
index 3b99696..af3d59b 100644
--- a/app/widgets/gimpcellrendererviewable.c
+++ b/app/widgets/gimpcellrendererviewable.c
@@ -317,31 +317,36 @@ gimp_cell_renderer_viewable_clicked (GimpCellRendererViewable *cell,
const gchar *path,
GdkModifierType state)
{
- GdkEvent *event;
g_return_if_fail (GIMP_IS_CELL_RENDERER_VIEWABLE (cell));
g_return_if_fail (path != NULL);
- g_signal_emit (cell, viewable_cell_signals[CLICKED], 0, path, state);
-
- event = gtk_get_current_event ();
-
- if (event)
+ if (cell->renderer)
{
- GdkEventButton *bevent = (GdkEventButton *) event;
+ GdkEvent *event = gtk_get_current_event ();
- if (bevent->type == GDK_BUTTON_PRESS &&
- (bevent->button == 1 || bevent->button == 2))
+ if (event)
{
- gimp_view_popup_show (gtk_get_event_widget (event),
- bevent,
- cell->renderer->context,
- cell->renderer->viewable,
- cell->renderer->width,
- cell->renderer->height,
- cell->renderer->dot_for_dot);
+ GdkEventButton *bevent = (GdkEventButton *) event;
+
+ if (bevent->type == GDK_BUTTON_PRESS &&
+ (bevent->button == 1 || bevent->button == 2))
+ {
+ gimp_view_popup_show (gtk_get_event_widget (event),
+ bevent,
+ cell->renderer->context,
+ cell->renderer->viewable,
+ cell->renderer->width,
+ cell->renderer->height,
+ cell->renderer->dot_for_dot);
+ }
+
+ gdk_event_free (event);
}
-
- gdk_event_free (event);
}
+
+ /* emit the signal last so no callback effects can set
+ * cell->renderer to NULL.
+ */
+ g_signal_emit (cell, viewable_cell_signals[CLICKED], 0, path, state);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]