After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 593152 - Closing „/“ search bar cause f-spot crash
Closing „/“ search bar cause f-spot crash
Status: RESOLVED FIXED
Product: f-spot
Classification: Other
Component: Browsing
0.6.x
Other Linux
: Normal major
: 0.7.0
Assigned To: Ruben Vermeersch
F-spot maintainers
Depends on:
Blocks:
 
 
Reported: 2009-08-26 12:56 UTC by Милош Поповић
Modified: 2009-11-20 08:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
log.txt (3.86 KB, text/plain)
2009-08-26 12:56 UTC, Милош Поповић
  Details
f-spot --debug output (5.15 KB, text/plain)
2009-11-09 08:36 UTC, Paul Wellner Bou
  Details
checking for invalid string range (535 bytes, patch)
2009-11-09 09:18 UTC, Paul Wellner Bou
accepted-commit_now Details | Review
checking for invalid string range and assuring parenthesis (628 bytes, patch)
2009-11-16 11:40 UTC, Paul Wellner Bou
none Details | Review
checking for invalid string range and assuring parenthesis, shorter version (592 bytes, patch)
2009-11-16 11:55 UTC, Paul Wellner Bou
accepted-commit_now Details | Review

Description Милош Поповић 2009-08-26 12:56:34 UTC
Created attachment 141747 [details]
log.txt

1. Open f-spot
2. Pres „/“ key and enter some search term
3. Close the search bar and f-spot will crash
Comment 1 Stephane Delcroix 2009-08-26 13:41:58 UTC
WORKSFORME
Comment 2 Maxxer 2009-08-26 13:57:11 UTC
I cannot reproduce too... Does it ALWAYS crash to you? Can you post the exact steps?
thanks
Comment 3 Милош Поповић 2009-08-26 14:05:37 UTC
Yes, it always crash. I tried Serbian and English locale
F-spot versions: 0.6.0.0, 0.6.1.1 and git.

It looks like GTK problem:
(f-spot:25888): GdkPixbuf-WARNING **: GdkPixbufLoader finalized without calling gdk_pixbuf_loader_close() - this is not allowed. You must explicitly end the data stream to the loader before dropping the last reference.

I am using gtk+-2.17.8.
Comment 4 Maxxer 2009-10-18 19:57:54 UTC
please post the exact steps, as we cannot reproduce.

(p.s. remove NEEDINFO when you reply)
Comment 5 Милош Поповић 2009-10-19 11:43:26 UTC
1. Open f-spot (from menu, terminal,...)
2. Pres „/“ on keyboard, and the search bar will appear
3. Enter some search criterium
4. Close the search bar („X“ button on right side of the bar)

I don’t know better :( The problem remains with new GTK/F-Spot.
Comment 6 Paul Wellner Bou 2009-11-09 08:36:35 UTC
Created attachment 147252 [details]
f-spot --debug output

Same here. I can reproduce it every time. The steps are the same as Милош Поповић is reporting. latest git is still affected.

Marshaling delete_text signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Cannot be negative.
Parameter name: length
  at System.String.Substring (Int32 startIndex, Int32 length) [0x00085] in /build/buildd/mono-2.4.2.3+dfsg/mcs/class/corlib/System/String.cs:370 
  at FSpot.Widgets.FindBar.HandleEntryTextDeleted (System.Object sender, Gtk.TextDeletedArgs args) [0x0000e] in /usr/src/f-spot/src/Widgets/FindBar.cs:118 

[...]

   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at FSpot.Driver.Main(System.String[] args) in /usr/src/f-spot/src/main.cs:line 244

Attached the complete f-spot --debug output.
Comment 7 Paul Wellner Bou 2009-11-09 08:49:42 UTC
That's the output of the log output line in FindBar.cs. I used the search string 'x' as example.

Log.Debug ("[HandleEntryTextDeleted] start {0} end {1} len {2} last {3}", args.StartPos, args.EndPos, length, last_entry_text);

[Debug 09:44:33.710] start 0 end -1 len -1 last x
Comment 8 Paul Wellner Bou 2009-11-09 09:18:01 UTC
Created attachment 147258 [details] [review]
checking for invalid string range

The TextDeleted handler seems to be called by:

		private void Clear ()
		{
			entry.Text = String.Empty;
			Hide ();
		}

Which is called when pressing on the clear button. Emptying the text of the entry seems to call the text deleted method, but without valid range parameters: 0 to -1.

Would it have any side effects checking this in HandleEntryTextDeleted?
Comment 9 Mikko Ruohola 2009-11-16 10:01:17 UTC
I confirm the bug and Patch (147258 above) fixes it for me.

I compiled f-spot from ubuntu src-deb with patch above. F-spot now performs like one would expect.
Comment 10 Ruben Vermeersch 2009-11-16 10:06:05 UTC
Review of attachment 147258 [details] [review]:

Looks reasonable to me. I don't see this behavior documented in the GTK+ docs, but given that it's a stock widget, we can't do much else. If it's up to me, it can go in. Will do so soon unless someone has serious objections.
Comment 11 Paul Wellner Bou 2009-11-16 11:40:20 UTC
Created attachment 147871 [details] [review]
checking for invalid string range and assuring parenthesis

As Mike pointed out, this patch assures the open_parens/close_parens variables setted correctly.
Comment 12 Paul Wellner Bou 2009-11-16 11:55:10 UTC
Created attachment 147872 [details] [review]
checking for invalid string range and assuring parenthesis, shorter version

Making it shorter.

string txt = length < 0 ? last_entry_text : last_entry_text.Substring (args.StartPos, length);
Comment 13 Stephane Delcroix 2009-11-20 08:47:27 UTC
commit bff8d401c444efb066c932f954cfca20447a5ac2
Author: Paul Werner Bou <paul@purecodes.org>
Date:   Fri Nov 20 09:44:47 2009 +0100

    avoid crashing on the FindBar
    
    Fixes bgo #147872