summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorBrian P. Hinz <bphinz@users.sf.net>2015-04-20 23:39:13 -0400
committerBrian P. Hinz <bphinz@users.sf.net>2015-04-20 23:47:48 -0400
commit706d6c44de6cca755588a0b3795181b22b51e8ee (patch)
treec2e3ac73323d56424d7ddc79a44a2883512002ee /contrib
parentccd09baedd01fa2c5a07f2665e8630378b53b246 (diff)
downloadtigervnc-706d6c44de6cca755588a0b3795181b22b51e8ee.tar.gz
tigervnc-706d6c44de6cca755588a0b3795181b22b51e8ee.zip
Added Fltk patch from Pierre to fix "checksum for freed object" segfault to contrib/fltk folder.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/fltk/fltk-1.3.x-osx-clip.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/contrib/fltk/fltk-1.3.x-osx-clip.patch b/contrib/fltk/fltk-1.3.x-osx-clip.patch
new file mode 100644
index 00000000..9e3fcdc5
--- /dev/null
+++ b/contrib/fltk/fltk-1.3.x-osx-clip.patch
@@ -0,0 +1,77 @@
+diff -up fltk-1.3.3/src/Fl_cocoa.mm.clip fltk-1.3.3/src/Fl_cocoa.mm
+--- fltk-1.3.3/src/Fl_cocoa.mm.clip 2014-11-02 22:06:07.000000000 +0100
++++ fltk-1.3.3/src/Fl_cocoa.mm 2015-04-20 13:45:03.526688921 +0200
+@@ -3061,6 +3061,14 @@ static void clipboard_check(void)
+ fl_trigger_clipboard_notify(1);
+ }
+
++static void resize_selection_buffer(int len, int clipboard) {
++ if (len <= fl_selection_buffer_length[clipboard])
++ return;
++ delete[] fl_selection_buffer[clipboard];
++ fl_selection_buffer[clipboard] = new char[len+100];
++ fl_selection_buffer_length[clipboard] = len+100;
++}
++
+ /*
+ * create a selection
+ * stuff: pointer to selected data
+@@ -3069,11 +3077,7 @@ static void clipboard_check(void)
+ */
+ void Fl::copy(const char *stuff, int len, int clipboard, const char *type) {
+ if (!stuff || len<0) return;
+- if (len+1 > fl_selection_buffer_length[clipboard]) {
+- delete[] fl_selection_buffer[clipboard];
+- fl_selection_buffer[clipboard] = new char[len+100];
+- fl_selection_buffer_length[clipboard] = len+100;
+- }
++ resize_selection_buffer(len+1, clipboard);
+ memcpy(fl_selection_buffer[clipboard], stuff, len);
+ fl_selection_buffer[clipboard][len] = 0; // needed for direct paste
+ fl_selection_length[clipboard] = len;
+@@ -3087,7 +3091,7 @@ void Fl::copy(const char *stuff, int len
+ }
+ }
+
+-static int get_plain_text_from_clipboard(char **buffer, int previous_length)
++static int get_plain_text_from_clipboard(int clipboard)
+ {
+ NSInteger length = 0;
+ NSPasteboard *clip = [NSPasteboard generalPasteboard];
+@@ -3109,21 +3113,17 @@ static int get_plain_text_from_clipboard
+ len = strlen(aux_c) + 1;
+ }
+ else len = [data length] + 1;
+- if ( len >= previous_length ) {
+- length = len;
+- delete[] *buffer;
+- *buffer = new char[len];
+- }
++ resize_selection_buffer(len, clipboard);
+ if (![found isEqualToString:utf8_format]) {
+- strcpy(*buffer, aux_c);
+- free(aux_c);
++ strcpy(fl_selection_buffer[clipboard], aux_c);
++ free(aux_c);
+ }
+ else {
+- [data getBytes:*buffer];
++ [data getBytes:fl_selection_buffer[clipboard]];
+ }
+- (*buffer)[len - 1] = 0;
++ fl_selection_buffer[clipboard][len - 1] = 0;
+ length = len - 1;
+- convert_crlf(*buffer, len - 1); // turn all \r characters into \n:
++ convert_crlf(fl_selection_buffer[clipboard], len - 1); // turn all \r characters into \n:
+ Fl::e_clipboard_type = Fl::clipboard_plain_text;
+ }
+ }
+@@ -3218,7 +3218,7 @@ void Fl::paste(Fl_Widget &receiver, int
+ if (clipboard) {
+ Fl::e_clipboard_type = "";
+ if (strcmp(type, Fl::clipboard_plain_text) == 0) {
+- fl_selection_length[1] = get_plain_text_from_clipboard( &fl_selection_buffer[1], fl_selection_length[1]);
++ fl_selection_length[1] = get_plain_text_from_clipboard(1);
+ }
+ else if (strcmp(type, Fl::clipboard_image) == 0) {
+ Fl::e_clipboard_data = get_image_from_clipboard( );