On Mon, 19 May 2014 19:51:28 +0200
Christophe <[email protected]> wrote:

> From: Christophe CURIS <[email protected]>
> 
> As raised by Carlos R. Mafra and Doug Torrance, when an image is used
> in a texture but the image cannot be loaded, there are some case
> where WPrefs misbehaves.
> This patch display a warning in every case where the image could not
> be loaded, and always switch to black texture as a fallback, which
> was not the case previously.
> 
> Signed-off-by: Christophe CURIS <[email protected]>
> ---
>  WPrefs.app/Appearance.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c
> index 9b42034..dc1d8c0 100644
> --- a/WPrefs.app/Appearance.c
> +++ b/WPrefs.app/Appearance.c
> @@ -512,12 +512,16 @@ static Pixmap renderTexture(WMScreen * scr,
> WMPropList * texture, int width, int path =
> wfindfileinarray(GetObjectForKey("PixmapPath"), str); if (path) {
>                       timage = RLoadImage(rc, path, 0);
> -                     if (!timage) {
> -                             wwarning("could not load file '%s':
> %s", path ? path : str, RMessageForError(RErrorCode));
> -                             texture =
> WMCreatePropListFromDescription("(solid, black)");
> -                             type = "solid";
> -                     }
> +                     if (!timage)
> +                             wwarning("could not load file '%s':
> %s", path, RMessageForError(RErrorCode)); wfree(path);
> +             } else {
> +                     wwarning("could not find file '%s' for %s of
> texture", str, type);
> +                     timage = NULL;
> +             }
> +             if (!timage) {
> +                     texture =
> WMCreatePropListFromDescription("(solid, black)");
> +                     type = "solid";
>               }
>       }
>  

Yes, I've already had something similar. But it still fails further

I've added those wwarnings to renderTexture(..)

wwarning("a");

        RConvertImage(rc, image, &pixmap);
wwarning("b");
        RReleaseImage(image);

wwarning("c");
        return pixmap;
}

it fails at RConvertImage(rc, image, &pixmap); :

% ./WPrefs
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(loadPixmaps(widgets.c:389)):
 warning: WINGs: could not load widget images file: could not open file
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:687)):
 warning: a
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:690)):
 warning: b
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:693)):
 warning: c
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:687)):
 warning: a
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:690)):
 warning: b
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:693)):
 warning: c
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:687)):
 warning: a
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:690)):
 warning: b
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:693)):
 warning: c
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:687)):
 warning: a
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:690)):
 warning: b
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:693)):
 warning: c
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:687)):
 warning: a
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:690)):
 warning: b
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:693)):
 warning: c
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:687)):
 warning: a
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:690)):
 warning: b
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:693)):
 warning: c
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:687)):
 warning: a
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:690)):
 warning: b
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:693)):
 warning: c
/home/amade/workdir/wmaker-crm/WPrefs.app/.libs/WPrefs(renderTexture(Appearance.c:687)):
 warning: a
X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
  Major opcode of failed request:  62 (X_CopyArea)
  Resource id in failed request:  0x0
  Serial number of failed request:  2976
  Current serial number in output stream:  2980



-- 
To unsubscribe, send mail to [email protected].

Reply via email to