aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/drag_and_drop.c
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-04-27 19:56:31 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-04-27 19:56:31 +0000
commit22e13e11976b2cabcdbaf13f059fb63e292ba9d9 (patch)
tree12cbdfdfaaa0ebb1b351b498f9c63362ee49a460 /gtk/drag_and_drop.c
parent4852c618d8f38a20111ab38a45c92a0d98f2713d (diff)
fix bugzilla #110 (http://bugs.ethereal.com/bugzilla/show_bug.cgi?id=110)
don't crash if dropping a file while running a capture or reading a file svn path=/trunk/; revision=14206
Diffstat (limited to 'gtk/drag_and_drop.c')
-rw-r--r--gtk/drag_and_drop.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gtk/drag_and_drop.c b/gtk/drag_and_drop.c
index 53feedc618..3fa42e6047 100644
--- a/gtk/drag_and_drop.c
+++ b/gtk/drag_and_drop.c
@@ -42,6 +42,8 @@
#include "compat_macros.h"
#include "file.h"
#include "simple_dialog.h"
+#include "main.h"
+#include "capture.h"
#include <epan/prefs.h>
#include <string.h>
@@ -309,6 +311,29 @@ GtkSelectionData *selection_data, guint info, guint t _U_, gpointer data _U_)
gpointer dialog;
if (info == DND_TARGET_URL) {
+ /* Usually we block incoming events by disabling the corresponding menu/toolbar items.
+ * This is the only place where an incoming event won't be blocked in such a way,
+ * so we have to take care of NOT loading a new file while a different process
+ * (e.g. capture/load/...) is still in progress. */
+
+ /* if a capture is running, do nothing but warn the user */
+ if((capture_opts->state != CAPTURE_STOPPED)) {
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION,
+ ESD_BTN_OK,
+ PRIMARY_TEXT_START "Drag and Drop currently not possible!" PRIMARY_TEXT_END "\n\n"
+ "Dropping a file isn't possible while capture is in progress.");
+ return;
+ }
+
+ /* if another file read is still in progress, do nothing but warn the user */
+ if((cfile.state == FILE_READ_IN_PROGRESS)) {
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION,
+ ESD_BTN_OK,
+ PRIMARY_TEXT_START "Drag and Drop currently not possible!" PRIMARY_TEXT_END "\n\n"
+ "Dropping a file isn't possible while loading another capture file.");
+ return;
+ }
+
/* ask the user to save it's current capture file first */
if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
/* user didn't saved his current file, ask him */