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 628087 - Banshee crash when quickly search music or video which belongs to unknown artist or album
Banshee crash when quickly search music or video which belongs to unknown art...
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: Metadata
1.6.1
Other other
: High critical
: 1.x
Assigned To: Banshee Maintainers
Banshee Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-08-27 04:27 UTC by Zhou Ting
Modified: 2011-03-22 15:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add String.IsNullOrEmpty() judgement before the search string parsing call (1.58 KB, patch)
2010-08-27 04:36 UTC, Zhou Ting
none Details | Review
backtrace when search same artist for a music with unknown artist (3.35 KB, patch)
2010-08-27 06:31 UTC, Zhou Ting
none Details | Review
Add String.IsNullOrEmpty() judgement before the search string parsing call (1.59 KB, patch)
2010-08-30 01:50 UTC, Zhou Ting
none Details | Review
patch based on 1.7.3 code base (1.57 KB, patch)
2010-10-14 02:49 UTC, Zhou Ting
committed Details | Review

Description Zhou Ting 2010-08-27 04:27:31 UTC
In MeeGo OS

1. Launch media player;
2. Select Music;
3. Select a musc item whose Album/Artist is Unknown, 
4. Select this music item in item list and right-click;
5. In context menu, select Search->By Matching Album or By Matching Artist;

Bashee will crash due to System.NullReferenceException
Comment 1 Felipe Besoaín Pino 2010-08-27 04:31:47 UTC
Thanks for taking the time to report this bug.
Without a stack trace from the crash it's very hard to determine what caused it.
Can you get us a stack trace? Please see http://live.gnome.org/GettingTraces for more information on how to do so. Thanks in advance!
Comment 2 Zhou Ting 2010-08-27 04:36:00 UTC
Created attachment 168855 [details] [review]
Add String.IsNullOrEmpty() judgement before the search string parsing call

Hello, I have a patch for this problem

Root Cause: When "track.AlbumTitle" or "track.ArtistName" is null or empty,
there is System.NullReferenceException while constructing and parsing query sql
at the call of value.Indexof() and value.Trim()

Solution: Add String.IsNullOrEmpty() judgement before the string parsing call.
Comment 3 Zhou Ting 2010-08-27 06:31:46 UTC
Created attachment 168858 [details] [review]
backtrace when search same artist for a music with unknown artist
Comment 4 Gabriel Burt 2010-08-29 20:29:37 UTC
Thanks for the patch.  Can you attach the stack trace, too?

One problem with the patch is you should never assign null to the Entry.Text property -- I believe that triggers warnings from Gtk+.
Comment 5 Zhou Ting 2010-08-30 01:50:44 UTC
Created attachment 169030 [details] [review]
Add String.IsNullOrEmpty() judgement before the search string parsing call

Thanks for the pointing out gtk warning. I change 'null' to 'String.Empty' in the patch

This is the stack trace when calling "OnSearchForSameArtist":

Marshaling activate 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.NullReferenceException: Object reference not set to an instance of an object
  at Hyena.Query.QueryField.ToTermString (System.String alias, System.String op, System.String value) [0x00000] in <filename unknown>:0
  at Hyena.Query.QueryField.ToTermString (System.String op, System.String value) [0x00000] in <filename unknown>:0
  at Banshee.Gui.TrackActions.OnSearchForSameArtist (System.Object o, System.EventArgs args) [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at Banshee.Gui.GtkBaseClient.Run()
   at Banshee.Gui.GtkBaseClient.Startup()
   at Hyena.Gui.CleanRoomStartup.Startup(Hyena.Gui.StartupInvocationHandler startup)
   at Banshee.Gui.GtkBaseClient.Startup()
   at Banshee.Gui.GtkBaseClient.Startup(System.String[] args)
   at Banshee.MeeGo.Client.MeeGoClient.Main(System.String[] args)
   at System.AppDomain.ExecuteAssembly(System.Reflection.Assembly , System.String[] )
   at System.AppDomain.ExecuteAssemblyInternal(System.Reflection.Assembly a, System.String[] args)
   at System.AppDomain.ExecuteAssembly(System.String assemblyFile, System.Security.Policy.Evidence assemblySecurity, System.String[] args)
   at System.AppDomain.ExecuteAssembly(System.String assemblyFile)
   at Booter.Booter.BootClient(System.String clientName)
   at Booter.Booter.Main(
Comment 6 Gabriel Burt 2010-09-01 15:38:01 UTC
I believe this was already filed and fixed as part this commit:

commit 6fcc86b3599c764baf419a57477753968c86d37b
Author: Gabriel Burt <gabriel.burt@gmail.com>
Date:   Thu Aug 12 20:03:54 2010

    [TrackActions] Prevent crash in search-for-same

    Specifically, when artist/album are blank/null.  Fixes bug #626786

Are you working against the git master branch?
Comment 7 Zhou Ting 2010-09-02 00:47:15 UTC
Thanks for the information.
The code base I use is banshee 1.6.1.

I noticed banshee 1.7.5 is released. Does 1.7.5 contain the fix for this problem? or I should wait for 1.8.0?  Thanks.
Comment 8 Gabriel Burt 2010-09-02 01:22:03 UTC
Yes, it's in 1.7.5.  I just pushed it to the stable-1.6 branch too, which a 1.6.2 release would be based on (if we do one).

*** This bug has been marked as a duplicate of bug 626786 ***
Comment 9 Zhou Ting 2010-10-14 02:44:53 UTC
Hello, it seems the patch can not resolve the problem in MeeGo.  http://git.gnome.org/browse/banshee/commit/?id=6fcc86b3599c764baf419a57477753968c86d37b 

Below is the backtrace when I apply the patch above based on banshee 1.7.3 source code. 

 at Banshee.Widgets.SearchEntry.set_Query (System.String value) [0x00000] in
<filename unknown>:0
  at Nereid.PlayerInterface.OnProgrammaticSearch (System.Object o,
System.EventArgs args) [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke
(ob ject,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[]
parameters, System.Globalization.CultureInfo culture)
[0x00000] in <filename unknown>:0
Comment 10 Zhou Ting 2010-10-14 02:49:44 UTC
Created attachment 172321 [details] [review]
patch based on 1.7.3 code base

Attachment is the patch based on 1.7.3 source code.
The patch can resolve the crash issue in MeeGo.
Comment 11 Gabriel Burt 2011-03-22 15:11:44 UTC
Comment on attachment 172321 [details] [review]
patch based on 1.7.3 code base

Committed, thanks!