From: Andy S. <laz...@gm...> - 2009-06-12 04:08:31
|
Hi all, I always got information "(Manatee:1945): Gtk-CRITICAL **: gtk_label_set_text: assertion `GTK_IS_LABEL (label)' failed" when i run my application. I found the problem is occur callback function `stringBufferDisplayPositionStatus`. ------------------------------> Function stringBufferDisplayPositionStatus start <------------------------------ -- | Display position information. stringBufferDisplayPositionStatus :: StringBuffer -> IO () stringBufferDisplayPositionStatus sb = liftM2 (printf "Ln %3d, Col %3d ") (stringBufferGetLine sb) (stringBufferGetColumn sb) >>= statusbarInfoSubitemSetText (stringBufferStatusbar sb) >> return () ------------------------------> Function stringBufferDisplayPositionStatus end <------------------------------ Function `stringBufferDisplayPositionStatus` is a callback function that when i type something in SourceView. Function `statusbarInfoSubitemSetText` is for update statusbar information, it implement in file Statusbar.hs. ------------------------------> Statusbar.hs start <------------------------------ module Manatee.Statusbar where import Control.Monad import Control.Monad.Trans import Graphics.UI.Gtk hiding (Statusbar) import qualified Graphics.UI.Gtk.Display.Statusbar as S type StatusbarSubitem = S.Statusbar data Statusbar = Statusbar {statusbarOutputSubitem ,statusbarInfoSubitem :: StatusbarSubitem } -- | Create new statusbar. statusbarNew :: BoxClass b => b -> IO Statusbar statusbarNew b = do let box = toBox b -- Status box for contain status boxes. statusBox <- hBoxNew False 0 boxPackStart box statusBox PackNatural 0 let subitem = statusbarSubitemNew statusBox liftM2 Statusbar subitem subitem -- | Create new sub-statusbar. statusbarSubitemNew :: BoxClass b => b -> IO StatusbarSubitem statusbarSubitemNew b = do let box = toBox b bar <- S.statusbarNew statusbarSetHasResizeGrip bar False -- don't show resize grip boxPackStart box bar PackGrow 0 -- use PackGrow for grow size return bar -- | Update output status. statusbarOutputSubitemSetText :: Statusbar -> String -> IO Bool statusbarOutputSubitemSetText sb str = statusbarSubitemSetText (statusbarOutputSubitem sb) str -- | Update info status. statusbarInfoSubitemSetText :: Statusbar -> String -> IO Bool statusbarInfoSubitemSetText sb str = statusbarSubitemSetText (statusbarInfoSubitem sb) str -- | Set text internal. statusbarSubitemSetText :: StatusbarSubitem -> String -> IO Bool statusbarSubitemSetText ss str = do id <- statusbarGetContextId ss str statusbarPush ss id str return False ------------------------------> Statusbar.hs end <------------------------------ And strange is i never use label in my application, why Gtk will output "(Manatee:1945): Gtk-CRITICAL **: gtk_label_set_text: assertion `GTK_IS_LABEL (label)' failed"? I missing something? Thanks! -- Andy |