Ticket #1294 (new defect)

Opened 6 months ago

segmentation fault when running webViewLoadUri in a multi-threaded program

Reported by: guest Owned by: cjacker
Priority: normal Milestone:
Component: Webkit Version:
Keywords: Cc:

Description

I've encountered a segmentation fault when running a multi-threaded gtk2hs+webkit application.

The program is quite simple:

-- main.hs
import Graphics.UI.Gtk
import Graphics.UI.Gtk.WebKit.WebView
import Control.Monad (forM_)

main :: IO ()
main = do
    initGUI
    w <- windowNew
    v <- webViewNew
    let load = webViewLoadUri v
    buttons <- hButtonBoxNew
    forM_ [ ("Google", "http://www.google.com/")
          , ("Twitter", "https://twitter.com")
          ] $ \(name, url) -> do
              btn <- buttonNewWithLabel name
              boxPackStart buttons btn PackNatural 2
              _ <- on btn buttonActivated $ load url
              return ()
    box <- vBoxNew False 1
    boxPackStart box buttons PackNatural 0
    boxPackStart box v PackGrow 0
    w `set`
        [ containerChild := box
        ]
    w `onDestroy` mainQuit
    widgetShowAll w
    mainGUI

Compile this program with ghc --make -threaded main.hs, run the executable, and click a button. The program exits with segmentation fault.

This error doesn't happen when compiled without -threaded option.

I've compiled on Arch Linux with ghc 7.6.3, gtk 0.12.5, and webkit 0.12.5.1. The native gtk package versions provided by Arch Linux are gtk2 2.24.22 and webkitgtk2 1.10.2.

Note: See TracTickets for help on using tickets.