Hi everyone.

I am trying to write code that when the user enters a " (double-quote) into a TextView, I catch this event and I want to add another
" (double-quote) char as the closing double-quote char.  However, I get the following error message:

(main.exe:4100): Gtk-WARNING **: Invalid text buffer iterator: either the iterator is uninitialized, or the characters/pixbufs/widgets in the buffer have been modified since the iterator was created.
You must use marks, character numbers, or line numbers to preserve a position across buffer modifications.
You can apply tags and insert marks without invalidating your iterators,
but any mutation that affects 'indexable' buffer contents (contents that can be referred to by character offset)
will invalidate all outstanding iterators.

I am using a very recent version of the gtk2hs darcs repo and GHC 7.2.2 and GTK 2.24.8 on windows 7.  I am still learning
the GTK way of ding things so it might also be that I am using iterators incorrectly.  If so, can someone just point me in the
right direction here.

Here is some sample Haskell code:

   -- hooks up the bufferInsertText signal handler
   idRef <- newIORef undefined
   buf <- textViewGetBuffer txtViewCmd
   id <- buf `on` bufferInsertText $ (handleCmdInsertText idRef)
   writeIORef idRef id

   -- event handler function
   handleCmdInsertText ::  IORef (ConnectId TextBuffer) -> TextIter -> String -> IO () 
   handleCmdInsertText idRef iter str = do
      id <- readIORef idRef
      signalBlock id

      if str == "\""
         then do
            isAdjacent <-insertMarkerIsAdjacentToText iter
            if not isAdjacent
               then do buf <- textIterGetBuffer iter
                       textBufferInsert buf iter "\""
               else return ()
         else return ()

      signalUnblock id
      return ()

   -- helper function for handleCmdInsertText event handler
   insertMarkerIsAdjacentToText :: TextIter -> IO Bool
   insertMarkerIsAdjacentToText currentIter = do
      charToLeft  <- textIterCopy currentIter >>= \iter -> do{ textIterBackwardChar iter; c <- textIterGetChar iter; return c; }
      charToRight <- textIterCopy currentIter >>= \iter -> do{ textIterForwardChar iter; c <- textIterGetChar iter; return c; }
      return $! (maybe False (/= ' ') charToLeft) || (maybe False (/= ' ') charToRight)

Kind regards