Correct way to update image data used in view3d?

Hello. Weirdness in image.update, maybe it’s the way I’m doing things.
I have an image, used by a texture slot of the material of an object displayed in the view 3d screen.
I take the pixels (cache = image.pixels[:]), do some filtering, then i put the pixels back (image.pixels[:] = cache) and:

  1. update the image with image.update().

This updates the image in the image editor area but not in the texture slot

  1. call image.update() followed by image.gl_load()

This updates the image in the image editor and in the texture slot but not in the view 3d

  1. do a very fishy thing:

image.gl_free()
image.pixels[:] = cache
image.update()
for i in range(0, 100): image.gl_load()

This updates everything, even when gl_load() fails 100 times in a row.

So the question is: should I call an exorcist for my PC, am I doing something wrong, is there some other way to update an image after the pixel buffer has been changed?

Thanks.

Are you sure it’s not just a display problem? Certain regions aren’t redrawn on datablock updates, you may need to tag_redraw() on those regions.

I did try tag_redraw and that unfortunately didn’t work. I mean, it works for other things - like refreshing the image displayed in the image editor after an update() call on the pixel buffer - but not for an update of the texture (applied to the object) seen in the view 3d.
I think I’m misusing the api because what I’m trying to do is exactly the same the “paint on the image” tool does - you draw on the 2d image and the texture in the view 3d is updated in real time - and that built in function works perfectly fine.