fix a simple search crash

This commit is contained in:
Matthias Clasen 2007-09-26 01:28:57 +00:00
parent 48f881747c
commit d7f0747939
2 changed files with 91 additions and 11 deletions

View File

@ -16,7 +16,7 @@
Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
Name: gtk2
Version: %{base_version}
Release: 3%{?dist}
Release: 4%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
Source: http://download.gnome.org/sources/gtk+/2.11/gtk+-%{version}.tar.bz2
@ -33,8 +33,8 @@ Patch2: workaround.patch
# fixed in upstream svn
Patch3: novalidate.patch
Patch4: libtracker.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=460194
Patch5: swt-tooltips.patch
Patch6: simple-search-crash.patch
BuildRequires: atk-devel >= %{atk_version}
BuildRequires: pango-devel >= %{pango_version}
@ -53,12 +53,8 @@ BuildRequires: libXrender-devel
BuildRequires: libXcursor-devel
BuildRequires: libXfixes-devel
BuildRequires: libXinerama-devel
# for patch 2
#BuildRequires: gamin-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Obsoletes: gtk+-gtkbeta
Obsoletes: Inti
# Conflicts with packages containing theme engines
# built against the 2.4.0 ABI
@ -105,11 +101,6 @@ Requires: pkgconfig
Requires: automake
# for /usr/share/gtk-doc/html
Requires: gtk-doc
Obsoletes: gtk+-gtkbeta-devel
Obsoletes: Inti-devel
## avoid header collisions
Conflicts: gtk+-devel <= 1.2.8
Conflicts: gdk-pixbuf-devel <= 0.11
%description devel
The gtk+-devel package contains the header files and developer
@ -124,6 +115,7 @@ docs for the GTK+ widget toolkit.
%patch3 -p1 -b .novalidate
%patch4 -p1 -b .libtracker
%patch5 -p1 -b .swt-tooltips
%patch6 -p0 -b .simple-search-crash
for i in config.guess config.sub ; do
test -f %{_datadir}/libtool/$i && cp %{_datadir}/libtool/$i .
@ -306,6 +298,10 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/gtk-2.0
%changelog
* Tue Sep 25 2007 Matthias Clasen <mclasen@redhat.com> - 2.12.0-4
- Fix a crash in simple search
- Drop obsolete Obsoletes and Conflicts
* Thu Sep 20 2007 Matthias Clasen <mclasen@redhat.com> - 2.12.0-3
- Fix a problem with swt and tooltips

84
simple-search-crash.patch Normal file
View File

@ -0,0 +1,84 @@
Index: gtk/gtksearchenginesimple.c
===================================================================
--- gtk/gtksearchenginesimple.c (revision 18864)
+++ gtk/gtksearchenginesimple.c (working copy)
@@ -72,19 +72,27 @@ struct _GtkSearchEngineSimplePrivate
G_DEFINE_TYPE (GtkSearchEngineSimple, _gtk_search_engine_simple, GTK_TYPE_SEARCH_ENGINE);
static void
-finalize (GObject *object)
+gtk_search_engine_simple_dispose (GObject *object)
{
GtkSearchEngineSimple *simple;
+ GtkSearchEngineSimplePrivate *priv;
simple = GTK_SEARCH_ENGINE_SIMPLE (object);
+ priv = simple->priv;
- if (simple->priv->query)
+ if (priv->query)
+ {
+ g_object_unref (priv->query);
+ priv->query = NULL;
+ }
+
+ if (priv->active_search)
{
- g_object_unref (simple->priv->query);
- simple->priv->query = NULL;
+ priv->active_search->cancelled = TRUE;
+ priv->active_search = NULL;
}
- G_OBJECT_CLASS (_gtk_search_engine_simple_parent_class)->finalize (object);
+ G_OBJECT_CLASS (_gtk_search_engine_simple_parent_class)->dispose (object);
}
static SearchThreadData *
@@ -131,12 +139,10 @@ search_thread_done_idle (gpointer user_d
data = user_data;
- if (!data->cancelled)
- {
- _gtk_search_engine_finished (GTK_SEARCH_ENGINE (data->engine));
- data->engine->priv->active_search = NULL;
- }
-
+ if (!data->cancelled)
+ _gtk_search_engine_finished (GTK_SEARCH_ENGINE (data->engine));
+
+ data->engine->priv->active_search = NULL;
search_thread_data_free (data);
return FALSE;
@@ -181,6 +187,7 @@ send_batch (SearchThreadData *data)
hits = g_new (SearchHits, 1);
hits->uris = data->uri_hits;
hits->thread_data = data;
+
gdk_threads_add_idle (search_thread_add_hits_idle, hits);
}
data->uri_hits = NULL;
@@ -349,7 +356,7 @@ _gtk_search_engine_simple_class_init (Gt
GtkSearchEngineClass *engine_class;
gobject_class = G_OBJECT_CLASS (class);
- gobject_class->finalize = finalize;
+ gobject_class->dispose = gtk_search_engine_simple_dispose;
engine_class = GTK_SEARCH_ENGINE_CLASS (class);
engine_class->set_query = gtk_search_engine_simple_set_query;
Index: gtk/gtkfilechooserdefault.c
===================================================================
--- gtk/gtkfilechooserdefault.c (revision 18864)
+++ gtk/gtkfilechooserdefault.c (working copy)
@@ -8994,6 +8994,8 @@ search_stop_searching (GtkFileChooserDef
if (impl->search_engine)
{
+ _gtk_search_engine_stop (impl->search_engine);
+
g_object_unref (impl->search_engine);
impl->search_engine = NULL;
}