Do not use
sourceBitmap
in other threads. Save bitmap width and height in local variables and use them instead.