From d95d110d8d72846ca6ac4ce3b58ff04274b1a17a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Jan 2009 08:17:35 +0000 Subject: [#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. --- intern/ghost/intern/GHOST_SystemX11.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'intern') diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 8073756e453..9950ef88879 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -1031,15 +1031,20 @@ getClipboard(int flag //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; } } -- cgit v1.2.3 From c63fcd27994875e31878619875ad3324232bf90d Mon Sep 17 00:00:00 2001 From: Diego Borghetti Date: Fri, 30 Jan 2009 21:01:18 +0000 Subject: Fix revision: 18690, bug #17850 The problem was that Qt convert the text to the type STRING or UTF8, that is why Blender can't get the text, now should be work fine. --- intern/ghost/intern/GHOST_SystemX11.cpp | 45 +++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'intern') diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 9950ef88879..02dfdc2e25c 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -981,11 +981,11 @@ getClipboard(int flag ) const { //Flag //0 = Regular clipboard 1 = selection - static Atom Primary_atom, clip_String, compound_text; + static Atom Primary_atom, clip_String, compound_text, a_text, a_string; Atom rtype; Window m_window, owner; unsigned char *data, *tmp_data; - int bits; + int bits, count; unsigned long len, bytes; XEvent xevent; @@ -996,6 +996,8 @@ getClipboard(int flag clip_String = XInternAtom(m_display, "_BLENDER_STRING", False); compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False); + a_text= XInternAtom(m_display, "TEXT", False); + a_string= XInternAtom(m_display, "STRING", False); //lets check the owner and if it is us then return the static buffer if(flag == 0) { @@ -1029,23 +1031,46 @@ getClipboard(int flag XFlush(m_display); //This needs to change so we do not wait for ever or check owner first + count= 1; while(1) { XNextEvent(m_display, &xevent); - if(xevent.type == SelectionNotify) { - if (xevent.xselection.property ) { /* eric4 on linux gives zero Atom xevent.xselection.property value, closes blender instantly */ + if(xevent.type == SelectionNotify) { + if (xevent.xselection.property == None) { + /* Ok, the client can't convert the property + * to some that we can handle, try other types.. + */ + if (count == 1) { + XConvertSelection(m_display, Primary_atom, a_text, clip_String, m_window, CurrentTime); + count++; + } + else if (count == 2) { + XConvertSelection(m_display, Primary_atom, a_string, clip_String, m_window, CurrentTime); + count++; + } + else { + /* Ok, the owner of the selection can't + * convert the data to something that we can + * handle. + */ + return(NULL); + } + } + else { 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); + if (bits == 8 && (rtype == compound_text || rtype == a_text || rtype == a_string)) { + tmp_data = (unsigned char*) malloc(strlen((char*)data)+1); + strcpy((char*)tmp_data, (char*)data); + } + else + tmp_data= NULL; + XFree(data); return (GHOST_TUns8*)tmp_data; } } + return(NULL); } - else { - fprintf(stderr, "error: cut buffer had a zero xevent.xselection.property, FIXME\n"); // XXX fix this problem! - } - return NULL; } } } -- cgit v1.2.3 From 86c25491e14d11174324ec14056d7cc94891d359 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 6 Feb 2009 16:38:53 +0000 Subject: =?UTF-8?q?[#18257]=20Workaround=20for=20bug=20in=20freealut=201.1?= =?UTF-8?q?.0=20by=20J=C3=B6rg=20M=C3=BCller=20(nexyon)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since this area is not maintained, I can only say it works on my system (linux/32bit) And nexyon assured me he checked over this patch well. Blender using the deprecated function is not great, but nexyon's bugfix would not be available until the next version of freealut so better to work around it by using the new function. Please test game sounds play back on win32 and Mac, in cases that it worked in the first place. --- intern/SoundSystem/openal/SND_OpenALDevice.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'intern') diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.cpp b/intern/SoundSystem/openal/SND_OpenALDevice.cpp index c660e9aecba..9ce30f985ac 100644 --- a/intern/SoundSystem/openal/SND_OpenALDevice.cpp +++ b/intern/SoundSystem/openal/SND_OpenALDevice.cpp @@ -235,7 +235,8 @@ SND_OpenALDevice::SND_OpenALDevice() if (m_context) { #ifdef AL_VERSION_1_1 - alcMakeContextCurrent((ALCcontext*)m_context); + alcMakeContextCurrent((ALCcontext*)m_context); + alutInitWithoutContext(NULL, NULL); /* in this case we dont want alut to initialize the context, see above */ #else alcMakeContextCurrent(m_context); #endif @@ -380,6 +381,9 @@ SND_OpenALDevice::~SND_OpenALDevice() #else if (m_device) alcCloseDevice((ALCdevice*) m_device); +#ifdef AL_VERSION_1_1 + alutExit(); +#endif #endif } @@ -437,7 +441,9 @@ SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name, alutLoadWAVMemory((char*)memlocation, &sampleformat, &data, &numberofsamples, &samplerate); // openal_2.12 #else #ifdef AL_VERSION_1_1 - alutLoadWAVMemory((ALbyte*)memlocation, &sampleformat, &data, &numberofsamples, &samplerate, &loop);// openal_2.14+ + float frequency = 0.0f; + data = alutLoadMemoryFromFileImage(memlocation, size, &sampleformat, &numberofsamples, &frequency); + samplerate = (int)frequency; #else alutLoadWAVMemory((signed char*)memlocation, &sampleformat, &data, &numberofsamples, &samplerate, &loop);// openal_2.14+ @@ -480,7 +486,11 @@ SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name, } /* and free the original stuff (copy was made in openal) */ +#if defined(OUDE_OPENAL) || defined (__APPLE__) || !defined(AL_VERSION_1_1) alutUnloadWAV(sampleformat, data, numberofsamples, samplerate); +#else + free(data); +#endif } } else -- cgit v1.2.3 From 570b48aae6f074ed19a3fc58b8e2a34b38123a49 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 22 Feb 2009 10:22:49 +0000 Subject: BGE Py API print filename:line with ShowDeprecationWarning(). Typo in scripttemplate_gamelogic.py removed 2 unneeded typedefs --- intern/SoundSystem/openal/SND_OpenALDevice.h | 2 +- intern/SoundSystem/sdl/SND_SDLCDDevice.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'intern') diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.h b/intern/SoundSystem/openal/SND_OpenALDevice.h index b8c64762a56..a7b97cc314f 100644 --- a/intern/SoundSystem/openal/SND_OpenALDevice.h +++ b/intern/SoundSystem/openal/SND_OpenALDevice.h @@ -32,7 +32,7 @@ #include "SND_AudioDevice.h" #include "SoundDefines.h" -typedef struct SDL_CD; +struct SDL_CD; class SND_OpenALDevice : public SND_AudioDevice { diff --git a/intern/SoundSystem/sdl/SND_SDLCDDevice.h b/intern/SoundSystem/sdl/SND_SDLCDDevice.h index 15cb1975d74..96600d53630 100644 --- a/intern/SoundSystem/sdl/SND_SDLCDDevice.h +++ b/intern/SoundSystem/sdl/SND_SDLCDDevice.h @@ -29,7 +29,7 @@ #ifndef SND_SDLCDDEVICE #define SND_SDLCDDEVICE -typedef struct SDL_CD; +struct SDL_CD; class SND_SDLCDDevice { -- cgit v1.2.3 From 4d9252640139401be5a67fc2d267176be95eaca8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 26 Feb 2009 12:43:24 +0000 Subject: build blenderplayer without opennl and decimation --- intern/decimation/SConscript | 2 +- intern/opennl/SConscript | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'intern') diff --git a/intern/decimation/SConscript b/intern/decimation/SConscript index cf199fb3bc5..0df93032394 100644 --- a/intern/decimation/SConscript +++ b/intern/decimation/SConscript @@ -5,4 +5,4 @@ sources = env.Glob('intern/*.cpp') incs = '. ../moto/include ../container ../memutil' -env.BlenderLib ('bf_decimation', sources, Split(incs) , [], libtype=['core','common','player'], priority = [10, 20, 25] ) +env.BlenderLib ('bf_decimation', sources, Split(incs) , [], libtype=['core','common'], priority = [10, 20] ) diff --git a/intern/opennl/SConscript b/intern/opennl/SConscript index e46cefbff58..f68810d2f16 100644 --- a/intern/opennl/SConscript +++ b/intern/opennl/SConscript @@ -6,7 +6,7 @@ sources = env.Glob('intern/*.c') + env.Glob('superlu/*.c') incs = 'extern superlu' if (env['OURPLATFORM'] == 'win32-mingw'): - env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','intern','player'], priority=[1,80,22] ) + env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','intern'], priority=[1,80] ) else: - env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core','player'], priority=[55,22] ) + env.BlenderLib ('blender_ONL', sources, Split(incs), [], libtype=['core'], priority=[55] ) -- cgit v1.2.3 From 28f6d223d079b1e5cb67e3fc22fb7f818deb8dcb Mon Sep 17 00:00:00 2001 From: Kent Mein Date: Mon, 16 Mar 2009 17:02:19 +0000 Subject: This is patch: [#17974] two small fix for blender 2.48 (memory leak and uninitalized vars) Submitted By: Pavel Nemec (nemecp) (changes delete to [] and sets to vars to NULL) Kent --- intern/opennl/superlu/get_perm_c.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'intern') diff --git a/intern/opennl/superlu/get_perm_c.c b/intern/opennl/superlu/get_perm_c.c index e255b4a76bd..4c0ee95c4c6 100644 --- a/intern/opennl/superlu/get_perm_c.c +++ b/intern/opennl/superlu/get_perm_c.c @@ -366,6 +366,10 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c) int *b_rowind, *dhead, *qsize, *llist, *marker; double t, SuperLU_timer_(); + /* make gcc happy */ + b_rowind=NULL; + b_colptr=NULL; + m = A->nrow; n = A->ncol; -- cgit v1.2.3