[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18690] trunk/blender/intern/ghost/intern/ GHOST_SystemX11.cpp: [#17850] Copying text from Eric4 to Blender crashes Blender

Campbell Barton ideasman42 at gmail.com
Tue Jan 27 09:18:19 CET 2009


Revision: 18690
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18690
Author:   campbellbarton
Date:     2009-01-27 09:17:35 +0100 (Tue, 27 Jan 2009)

Log Message:
-----------
[#17850] Copying text from Eric4 to Blender crashes Blender
The crash is caused by calling XGetWindowProperty when xevent.xselection.property is zero.
Not a proper fix because clipboard can paste the data without trouble.

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp	2009-01-27 05:04:23 UTC (rev 18689)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp	2009-01-27 08:17:35 UTC (rev 18690)
@@ -1031,15 +1031,20 @@
 	//This needs to change so we do not wait for ever or check owner first
 	while(1) {
 		XNextEvent(m_display, &xevent);
-		if(xevent.type == SelectionNotify) {
-			if(XGetWindowProperty(m_display, m_window, xevent.xselection.property, 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
-				if (data) {
-					tmp_data = (unsigned char*) malloc(strlen((char*)data)+1);
-					strcpy((char*)tmp_data, (char*)data);
-					XFree(data);
-					return (GHOST_TUns8*)tmp_data;
+		if(xevent.type == SelectionNotify) { 
+			if (xevent.xselection.property ) { /* eric4 on linux gives zero Atom xevent.xselection.property value, closes blender instantly */
+				if(XGetWindowProperty(m_display, m_window, xevent.xselection.property , 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
+					if (data) {
+						tmp_data = (unsigned char*) malloc(strlen((char*)data)+1);
+						strcpy((char*)tmp_data, (char*)data);
+						XFree(data);
+						return (GHOST_TUns8*)tmp_data;
+					}
 				}
 			}
+			else {
+				fprintf(stderr, "error: cut buffer had a zero xevent.xselection.property, FIXME\n"); // XXX fix this problem!
+			}
 			return NULL;
 		}
 	}





More information about the Bf-blender-cvs mailing list