The panel crashes when I use drag-drop to drag text from a text editor or files from Thunar onto a launcher item (launcher button or item in launcher menu) with an invalid command or a command with arguments. Reproducible: Always Steps to Reproduce: 1. Add a launcher plugin with an invalid command or a command with arguments. 2. Drag some files from Thunar or anything that can be dropped onto launcher items, and drop them onto the launcher plugin. Actual Results: An error dialog pops up: Could not run "Laucher name" ... and then the panel crashes when I press the Close button. Expected Results: The error dialog is expected in the case of an actual invalid command. The panel shouldn't crash. The command should be splitted in the case of a command with arguments, and the arguments included when running the command. As it is now, the full command, including arguments, will be used as the actual command with the dropped text as arguments. My system is latest Xfce SVN in Ubuntu 5.10, GTK+ 2.8.6, GLib 2.8.3.
Crap. Can you get a backtrace for the crash? That obviously should not happen. The argument handling is rather hard to do if you think of all the possibilities for command line arguments, with and without quotes, that are posssible. I'm a little afraid we would have to implement an entire shell to get this right. I'm certainly open for suggestions about how to improve things, I'm quite sure it could be better than what the panel is doing now.
Created attachment 463 Backtrace I forgot the backtrace. It isn't long, but I hope it will help.
(In reply to comment #1) > The argument handling is rather hard to do if you think of all the possibilities > for command line arguments, with and without quotes, that are posssible. I'm a > little afraid we would have to implement an entire shell to get this right. > > I'm certainly open for suggestions about how to improve things, I'm quite sure > it could be better than what the panel is doing now. Can't you use g_shell_parse_argv () ? http://developer.gnome.org/doc/API/2.0/glib/glib-Shell-related-Utilities.html#g-shell-parse-argv
Ok, I think I fixed the crash. We can use g_shell_parse_argv (), but it is a bit of a pity when we get the arguments from drag and drop as a split up list of files. We would need to glue them together and then split them up again. There is a FIXME in the code about the need to split up commands with arguments, though, so I know this would come up one day ;-)
(In reply to comment #4) > Ok, I think I fixed the crash. Thanks, it doesn't crash any more, at least when dropping text on launchers with invalid commands. > We can use g_shell_parse_argv (), but it is a bit of a pity when we get the > arguments from drag and drop as a split up list of files. We would need to glue > them together and then split them up again. There is a FIXME in the code about > the need to split up commands with arguments, though, so I know this would come > up one day ;-) I don't know much about C and GLib, but isn't it possible to first use g_shell_parse_argv on the launcher command (that is, without the dropped files), and then append the files to the argument array, before executing?
(In reply to comment #5) > I don't know much about C and GLib, but isn't it possible to first use > g_shell_parse_argv on the launcher command (that is, without the dropped files), > and then append the files to the argument array, before executing? Indeed it is. I'm sure that is what I had in mind when adding that FIXME comment... seems I needed this bug report to actually go and implement it. Could you try now? It should be fixed.
(In reply to comment #6) > Could you try now? It should be fixed. The crash is now fixed, as well as the problem with arguments. Thanks, Jasper :)