[Gtk-sharp-list] Accessing System.Drawing.Bitmap from GTK# Thread throws Object Currently in use elsewhere exception

netgear cool_rainbow at rocketmail.com
Thu Jan 8 06:49:50 UTC 2015


Im trying to manipulate an image using system.drawing in GTk#.I want the UI
to update the image on screen as soon as the user updates a textbox.To
implement this i tried using the background worker from winforms,it worked
but when the textbox is updated at a higher speed the application becomes
stuck with no error.

So i took a look at multithreading in GTK here
http://www.mono-project.com/docs/gui/gtksharp/responsive-applications/ and
created a thread .

void textboxchanged()
{
    Thread thr = new Thread (new ThreadStart (ThreadRoutine));
    thr.Start ();

  }

  static void ThreadRoutine ()
  {
        LargeComputation ();

  }

  static void LargeComputation ()
  {
    image=new Bitmap(backupimage);
   //Long image processing 
  }

It works poorly than the background worker throws up object currently in use
elsewhere error here image=new Bitmap(backupimage); when the speed of entry
in textbox is even a little fast.What im i doing wrong ?



--
View this message in context: http://mono.1490590.n4.nabble.com/Accessing-System-Drawing-Bitmap-from-GTK-Thread-throws-Object-Currently-in-use-elsewhere-exception-tp4665133.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.


More information about the Gtk-sharp-list mailing list