summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-12-08 17:10:05 +0000
committerManolo Gouy <Manolo>2010-12-08 17:10:05 +0000
commit163476f6659e4bc9e6e8648baaaa8404167ff940 (patch)
tree91e7ee3603429684a5ea8bf25a8c2df7f43cd39d
parentee3e8180b40d11a5d08b6fefd5ae79f2d27d6e82 (diff)
Fix STR #2277 for crash when DnD of filename to editor.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7980 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_x.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 791d5d35d..be4a88026 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -958,15 +958,16 @@ int fl_handle(const XEvent& thisevent)
#ifndef X_HAVE_UTF8_STRING
text_list = (char**)&portion;
#else
- int list_count;
+ int list_count = 0;
Xutf8TextPropertyToTextList(fl_display, (const XTextProperty*)&text_prop, &text_list, &list_count);
+ if (list_count == 0) text_list = (char**)&portion;
#endif
int bytesnew = strlen(*text_list)+1;
buffer = (unsigned char*)realloc(buffer, bytesread+bytesnew+remaining);
memcpy(buffer+bytesread, *text_list, bytesnew);
XFree(portion);
#ifdef X_HAVE_UTF8_STRING
- XFreeStringList(text_list);
+ if (list_count > 0) XFreeStringList(text_list);
#endif
bytesread += bytesnew - 1;
if (!remaining) break;