Skip to content

Received unexpected nullPtr in "applicationNew" #142

@MuratOzsoyler

Description

@MuratOzsoyler

I'm new to both Haskell and gi, and trying to follow GTK+ documentation which is provided as devhelp program. I wrote this trivial program and it is compiled with no errors:

{-# LANGUAGE OverloadedStrings, OverloadedLabels #-}
module Main where
  
import qualified Data.Text as T
import System.Environment (getProgName, getArgs)

import qualified GI.Gio as Gio
import qualified GI.Gtk as Gtk
import Data.GI.Base

activateApp :: {- Gtk.Application -> -} IO ()
activateApp {- app -} = do
  appWindow <- new Gtk.ApplicationWindow [ #title := "Deneme" ] 
  -- on appWindow #close Gtk.widgetDestroy
  #showAll appWindow 
  return ()

main :: IO ()
main = do

  progName <- getProgName
  args <- getArgs

  app <- Gtk.applicationNew (Just "deneme") [ Gio.ApplicationFlagsFlagsNone ]

  on app #startup activateApp
  
  status <- Gio.applicationRun app $ Just $ map T.pack args

  return ()

when I tried to run it, I got this message:
first-gtk-trial.EXE:5092): Gtk-CRITICAL **: gtk_application_new: assertion 'application_id == NULL || g_application_id_is_valid (application_id)' failed
first-gtk-trial.EXE: Received unexpected nullPtr in "applicationNew".
This is a bug in the introspection data, please report it at
https://github.com/haskell-gi/haskell-gi/issues
CallStack (from HasCallStack):
checkUnexpectedReturnNULL, called at .\GI\Gtk\Objects\Application.hs:971:5 in gi-gtk-3.0.21-5hNtKhd2OEL1fcbHMSgHEZ:GI.Gtk.Objects.Application
applicationNew, called at src\Main.hs:24:10 in main:Main

I use stack nigthly build 2018-03-20 on Windows 10/

By the way examples are only for viewing videos etc. Are there any examples which show best practices from ground up?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions