! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Panel crashes when dropping text or files onto launcher with invalid command
Status:
RESOLVED: FIXED
Product:
Xfce4-panel

Comments

Description Stefan Stuhr 2006-02-27 19:36:53 CET
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.
Comment 1 Jasper Huijsmans editbugs 2006-02-27 19:46:36 CET
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.
Comment 2 Stefan Stuhr 2006-02-27 19:50:37 CET
Created attachment 463 
Backtrace

I forgot the backtrace. It isn't long, but I hope it will help.
Comment 3 Stefan Stuhr 2006-02-27 19:54:16 CET
(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
Comment 4 Jasper Huijsmans editbugs 2006-02-27 21:00:29 CET
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 ;-)
Comment 5 Stefan Stuhr 2006-02-27 21:27:03 CET
(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?
Comment 6 Jasper Huijsmans editbugs 2006-02-27 21:40:10 CET
(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.
Comment 7 Stefan Stuhr 2006-02-27 21:48:31 CET
(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 :)

Bug #1517

Reported by:
Stefan Stuhr
Reported on: 2006-02-27
Last modified on: 2010-11-20

People

Assignee:
Nick Schermer
CC List:
0 users

Version

Attachments

Backtrace (1.15 KB, text/plain)
2006-02-27 19:50 CET , Stefan Stuhr
no flags

Additional information