(define (open-input-gfile uri)
(let* ((uri* (->uri* uri 'open-input-gfile))
- (gfile (make-gfile uri*))
- (gstream (gfile-read gfile))
+ (gstream
+ (with-glib-lock
+ (lambda ()
+ (let* ((gfile (make-gfile uri*))
+ (gstream (gfile-read gfile)))
+ (gobject-unref! gfile)
+ gstream))))
(port (make-generic-i/o-port (make-binary-port
(make-g-stream-source gstream)
#f
'open-input-gfile)))
;;(port/set-coding port 'ISO-8859-1)
;;(port/set-line-ending port 'NEWLINE)
- (gobject-unref! gfile)
port))
(define (->uri* object caller)
(named-lambda (g-stream-source/has-bytes?)
#t)
(named-lambda (g-stream-source/read-bytes! buffer start end)
- (g-input-stream-read gstream buffer start end))
+ (with-glib-lock
+ (lambda () (g-input-stream-read gstream buffer start end))))
(named-lambda (g-stream-source/close)
(if open?
- (let ((value (g-input-stream-close gstream)))
+ (let ((value (with-glib-lock
+ (lambda () (g-input-stream-close gstream)))))
(set! open? #f)
value))))))
(define (open-output-gfile uri)
(let* ((uri* (->uri* uri 'open-output-gfile))
- (gfile (make-gfile uri*))
- (gstream (gfile-replace gfile #f #t 'private))
+ (gstream
+ (with-glib-lock
+ (lambda ()
+ (let* ((gfile (make-gfile uri*))
+ (gstream (gfile-replace gfile #f #t 'private)))
+ (gobject-unref! gfile)
+ gstream))))
(port (make-generic-i/o-port (make-binary-port
#f
(make-g-stream-sink gstream)
'open-output-gfile)))
;;(port/set-coding port 'ISO-8859-1)
;;(port/set-line-ending port 'NEWLINE)
- (gobject-unref! gfile)
port))
(define (make-g-stream-sink gstream)
(let ((open? #t))
(make-non-channel-output-sink
(named-lambda (g-stream-sink/write-bytes buffer start end)
- (g-output-stream-write gstream buffer start end))
+ (with-glib-lock
+ (lambda () (g-output-stream-write gstream buffer start end))))
(named-lambda (g-stream-sink/close)
(if open?
- (let ((value (g-output-stream-close gstream)))
+ (let ((value (with-glib-lock
+ (lambda () (g-output-stream-close gstream)))))
(set! open? #f)
value))))))
(define (gdirectory-read uri)
- (let* ((uri* (->uri* uri 'gdirectory-read))
- (gfile (make-gfile uri*))
- (names
- (map! (lambda (ginfo)
- (let ((name (gfile-info-get-attribute-value
- ginfo "standard::name")))
- (gobject-unref! ginfo)
- name))
- (gfile-children gfile "standard::name"))))
- (gobject-unref! gfile)
- names))
+ (let ((uri* (->uri* uri 'gdirectory-read)))
+ (with-glib-lock
+ (lambda ()
+ (let ((gfile (make-gfile uri*)))
+ (map! (lambda (ginfo)
+ (let ((name (gfile-info-get-attribute-value
+ ginfo "standard::name")))
+ (gobject-unref! ginfo)
+ name))
+ (let ((children (gfile-children gfile "standard::name")))
+ (gobject-unref! gfile)
+ children)))))))
(define (gfile-children gfile attributes)
(let ((genum (gfile-enumerate-children gfile attributes #f)))
(call-next-method object)
(let* ((gio-info (gio-cleanup-info object))
(gerror* (gio-cleanup-info-gerror-pointer gio-info)))
+ (assert-glib-locked '(initialize-instance <gio>))
(C-call "g_try_malloc0" gerror* (C-sizeof "* GError"))
(error-if-null gerror* "Could not create:" gerror*)))
(,modifier ,info #F))))))))))
(define-integrable-operator (cleanup-gerror-pointer gerror*)
+ (assert-glib-locked 'cleanup-gerror-pointer)
(if (not (alien-null? gerror*))
(let ((gerror (make-alien '|GError|)))
(C-> gerror* "* GError" gerror)
(alien-null! gerror*))))
(define-integrable-operator (cleanup-gio gio-info)
+ (assert-glib-locked 'cleanup-gio)
(let ((pending-op (gio-cleanup-info-pending-op gio-info)))
(if (not (memq pending-op '(#f ERROR CLOSED)))
(C-call "g_cancellable_cancel"
(cleanup-g-input-stream gio-info info)))
(define (cleanup-g-input-stream gio-info info)
- ;; For glib-cleanups. Run without-interrupts.
+ (assert-without-interruption 'cleanup-g-input-stream)
+ (assert-glib-locked 'cleanup-g-input-stream)
(cleanup-gio gio-info)
(cleanup-callback-id info g-input-stream read-id)
(cleanup-callback-id info g-input-stream skip-id))
+(define-integrable (dequeue! queue)
+ (without-glib-lock
+ (lambda ()
+ (thread-queue/dequeue! queue))))
+
(define (g-input-stream-read gstream buffer start end)
+ (assert-glib-locked 'g-input-stream-read)
(let* ((gio-info (gio-cleanup-info gstream))
(info (g-input-stream-cleanup-info gstream))
(callback-id (g-input-stream-cleanup-info-read-id info)))
(C-callback "async_ready")
callback-id)
(let* ((queue (gio-queue gstream))
- (value (thread-queue/dequeue! queue)))
+ (value (dequeue! queue)))
(if (string? value)
(begin
(set-gio-cleanup-info-pending-op! gio-info 'ERROR)
(define (make-read-finish-callback queue gerror*)
(C-callback
(named-lambda (read-finish-callback source result)
+ (assert-glib-locked 'read-finish-callback)
(let ((bytes (C-call "g_input_stream_read_finish" source result gerror*)))
(if (fix:= bytes -1)
(let ((message (%gerror-message gerror*)))
(maybe-yield-glib))
(define (g-input-stream-skip gstream count)
+ (assert-glib-locked 'g-input-stream-skip)
(let* ((gio-info (gio-cleanup-info gstream))
(info (g-input-stream-cleanup-info gstream))
(callback-id (g-input-stream-cleanup-info-skip-id info)))
(C-callback "async_ready")
callback-id)
(let* ((queue (gio-queue gstream))
- (value (thread-queue/dequeue! queue)))
+ (value (dequeue! queue)))
(if (string? value)
(begin
(set-gio-cleanup-info-pending-op! gio-info 'ERROR)
(define (make-skip-finish-callback queue gerror*)
(C-callback
(named-lambda (skip-finish-callback source result)
+ (assert-glib-locked 'skip-finish-callback)
(let ((bytes (C-call "g_input_stream_skip_finish" source result gerror*)))
(if (fix:= bytes -1)
(let ((message (%gerror-message gerror*)))
(%queue! queue bytes)))))))
(define (g-input-stream-close gstream)
+ (assert-glib-locked 'g-input-stream-close)
(gfile-close gstream
(named-lambda (close-input
gstream* priority gcancellable* callback id)
gio-info (g-input-stream-cleanup-info gstream)))))
(define (gfile-close gio callout make-callback cleanup)
+ (assert-glib-locked 'gfile-close)
(let* ((gio-info (gio-cleanup-info gio))
(queue (gio-queue gio))
(gerror* (gio-cleanup-info-gerror-pointer gio-info)))
(guarantee-gio-idle gio)
(let ((callback-id
- (without-interrupts ;don't leak callback IDs
+ (without-interruption ;don't leak callback IDs
(lambda ()
(let ((old (gio-cleanup-info-callback-id gio-info)))
(if old (de-register-c-callback old)))
(gobject-alien (gio-cleanup-info-gcancellable gio-info))
(C-callback "async_ready")
callback-id)
- (let ((value (thread-queue/dequeue! queue)))
+ (let ((value (dequeue! queue)))
(cond ((eq? value #t)
- (set-gio-cleanup-info-pending-op! gio-info 'CLOSED)
- (without-interrupts
+ (without-interruption
(lambda ()
+ (set-gio-cleanup-info-pending-op! gio-info 'CLOSED)
(cleanup gio-info)))
unspecific)
((string? value)
(define (make-input-close-finish-callback queue gerror*)
(C-callback
(named-lambda (input-close-finish-callback source result)
+ (assert-glib-locked 'input-close-finish-callback)
(if (fix:zero?
(C-call "g_input_stream_close_finish" source result gerror*))
(let ((message (%gerror-message gerror*)))
(cleanup-g-output-stream gio-info info)))
(define (cleanup-g-output-stream gio-info info)
- ;; For glib-cleanups. Run without-interrupts.
+ (assert-without-interruption 'cleanup-g-output-stream)
+ (assert-glib-locked 'cleanup-g-output-stream)
(cleanup-gio gio-info)
(cleanup-callback-id info g-output-stream write-id)
(cleanup-callback-id info g-output-stream flush-id))
(define (g-output-stream-write gstream buffer start end)
+ (assert-glib-locked 'g-output-stream-write)
(let* ((gio-info (gio-cleanup-info gstream))
(info (g-output-stream-cleanup-info gstream))
(callback-id (g-output-stream-cleanup-info-write-id info)))
(C-callback "async_ready")
callback-id)
(let* ((queue (gio-queue gstream))
- (value (thread-queue/dequeue! queue)))
+ (value (dequeue! queue)))
(if (string? value)
(begin
(set-gio-cleanup-info-pending-op! gio-info 'ERROR)
(define (make-write-finish-callback queue gerror*)
(C-callback
(named-lambda (write-finish-callback source result)
+ (assert-glib-locked 'write-finish-callback)
(let ((bytes
(C-call "g_output_stream_write_finish" source result gerror*)))
(if (fix:= bytes -1)
(%queue! queue bytes)))))))
(define (g-output-stream-flush gstream)
+ (assert-glib-locked 'g-output-stream-flush)
(let* ((gio-info (gio-cleanup-info gstream))
(info (g-output-stream-cleanup-info gstream))
(callback-id (g-output-stream-cleanup-info-flush-id info)))
(C-callback "async_ready")
callback-id)
(let* ((queue (gio-queue gstream))
- (value (thread-queue/dequeue! queue)))
+ (value (dequeue! queue)))
(if (string? value)
(begin
(set-gio-cleanup-info-pending-op! gio-info 'ERROR)
(define (make-flush-finish-callback queue gerror*)
(C-callback
(named-lambda (flush-finish-callback source result)
+ (assert-glib-locked 'flush-finish-callback)
(if (fix:zero?
(C-call "g_output_stream_flush_finish" source result gerror*))
(let ((message (%gerror-message gerror*)))
(%queue! queue #t))))))
(define (g-output-stream-close gstream)
+ (assert-glib-locked 'g-output-stream-close)
(gfile-close gstream
(named-lambda (close-output
gstream* priority gcancellable* callback id)
(define (make-output-close-finish-callback queue gerror*)
(C-callback
(named-lambda (output-close-finish-callback source result)
+ (assert-glib-locked 'output-close-finish-callback)
(if (fix:zero?
(C-call "g_output_stream_close_finish" source result gerror*))
(let ((message (%gerror-message gerror*)))
(set-alien/ctype! alien '|GFileInputStream|)))
(define (gfile-read gfile)
+ (assert-glib-locked 'gfile-read)
(gfile-open gfile 'OPEN
make-g-input-stream
(named-lambda (open-callout
(queue (gio-queue gstream))
(gerror* (gio-cleanup-info-gerror-pointer gio-info))
(callback-id
- (without-interrupts ;don't leak callback IDs
+ (without-interruption ;don't leak callback IDs
(lambda ()
(let ((id (make-callback (gobject-alien gstream) queue gerror*)))
(set-gio-cleanup-info-pending-op! gio-info operation)
(gobject-alien (gio-cleanup-info-gcancellable gio-info))
(C-callback "async_ready")
callback-id)
- (let ((value (thread-queue/dequeue! queue)))
+ (let ((value (dequeue! queue)))
(cond ((eq? value #t)
(set-gio-cleanup-info-pending-op! gio-info #f)
- (without-interrupts
+ (without-interruption
(lambda ()
(de-register-c-callback callback-id)
(set-gio-cleanup-info-callback-id! gio-info #f)
(define (make-open-finish-callback alien queue gerror*)
(C-callback
(named-lambda (open-finish-callback source result)
+ (assert-glib-locked 'open-finish-callback)
(C-call "g_file_read_finish" alien source result gerror*)
(if (alien-null? alien)
(let ((message (%gerror-message gerror*)))
(set-alien/ctype! alien '|GFileOutputStream|)))
(define (gfile-append-to gfile . flags)
+ (assert-glib-locked 'gfile-append-to)
(let ((flags* (->gfile-create-flags flags)))
(gfile-open gfile 'APPEND-TO
make-g-output-stream
(define (make-append-to-finish-callback alien queue gerror*)
(C-callback
(named-lambda (append-to-finish-callback source result)
+ (assert-glib-locked 'append-to-finish-callback)
(C-call "g_file_append_to_finish" alien source result gerror*)
(g-output-stream-finish alien queue gerror* 'APPEND-TO))))
(define (g-output-stream-finish alien queue gerror* op)
+ (assert-glib-locked 'g-output-stream-finish)
(if (alien-null? alien)
(let ((message (%gerror-message gerror*)))
(%trace ";"op"-finish-callback "message" "queue"\n")
info (make-flush-finish-callback queue gerror*))))
(define (gfile-create gfile . flags)
+ (assert-glib-locked 'gfile-create)
(let ((flags* (->gfile-create-flags flags)))
(gfile-open gfile 'CREATE
make-g-output-stream
(define (make-create-finish-callback alien queue gerror*)
(C-callback
(named-lambda (create-finish-callback source result)
+ (assert-glib-locked 'create-finish-callback)
(C-call "g_file_create_finish" alien source result gerror*)
(g-output-stream-finish alien queue gerror* 'CREATE))))
(define (gfile-replace gfile etag backup? . flags)
+ (assert-glib-locked 'gfile-replace)
(let ((etag (->gfile-etag etag))
(make-backups (if backup? 1 0))
(flags* (->gfile-create-flags flags)))
(define (make-replace-finish-callback alien queue gerror*)
(C-callback
(named-lambda (replace-finish-callback source result)
+ (assert-glib-locked 'replace-finish-callback)
(C-call "g_file_replace_finish" alien source result gerror*)
(g-output-stream-finish alien queue gerror* 'REPLACE))))
\f
(define (gfile-query-info gfile attributes follow-symlinks?)
(guarantee string? attributes 'gfile-query-info)
+ (assert-glib-locked 'gfile-query-info)
(gfile-open gfile 'QUERY
make-gfile-info
(named-lambda (query-callout
(define (make-query-finish-callback alien queue gerror*)
(C-callback
(named-lambda (query-finish-callback source result)
+ (assert-glib-locked 'query-finish-callback)
(C-call "g_file_query_info_finish" alien source result gerror*)
(if (alien-null? alien)
(let ((message (%gerror-message gerror*)))
(define (gfile-info-list-attributes ginfo namespace)
(guarantee string? namespace 'gfile-info-list-attributes)
+ (assert-glib-locked 'gfile-info-list-attributes)
(map! string->symbol
(let ((alien (make-cstringv
(lambda (copy)
strings))))
(define (gfile-info-get-attribute-status ginfo name)
+ (assert-glib-locked 'gfile-info-get-attribute-status)
(let ((code (C-call "g_file_info_get_attribute_status"
(gobject-alien ginfo)
(string->utf8 name))))
(else (error "Unknown GFileAttributeStatus:" code)))))
(define (gfile-info-get-attribute-value ginfo name)
+ (assert-glib-locked 'gfile-info-get-attribute-value)
(let* ((alien (gobject-alien ginfo))
(name-bv (string->utf8 name))
(type (C-call "g_file_info_get_attribute_type" alien name-bv)))
(cleanup-gfile-enumerator gio-info ginfos)))
(define (cleanup-gfile-enumerator gio-info ginfos)
- ;; For glib-cleanups. Run without-interrupts.
+ (assert-without-interruption 'cleanup-gfile-enumerator)
+ (assert-glib-locked 'cleanup-gfile-enumerator)
(cleanup-gio gio-info)
(cleanup-ginfos ginfos))
(define (cleanup-ginfos glist)
+ (assert-without-interruption 'cleanup-ginfos)
+ (assert-glib-locked 'cleanup-ginfos)
(if (not (alien-null? glist))
(let ((scan (copy-alien glist))
(ginfo (make-alien '|GFileInfo|)))
(define (gfile-enumerate-children gfile attributes follow-symlinks?)
(guarantee string? attributes 'gfile-enumerate-children)
+ (assert-glib-locked 'gfile-enumerate-children)
(gfile-open gfile 'OPEN
make-gfile-enumerator
(named-lambda (query-callout
(define (make-enumerator-finish-callback alien queue gerror*)
(C-callback
(named-lambda (enumerator-finish-callback source result)
+ (assert-glib-locked 'enumerator-finish-callback)
(C-call "g_file_enumerate_children_finish" alien source result gerror*)
(if (alien-null? alien)
(let ((message (%gerror-message gerror*)))
(define (gfile-enumerator-next-files genum nfiles)
(guarantee fixnum? nfiles 'gfile-enumerator-next-files)
+ (assert-glib-locked 'gfile-enumerator-next-files)
(let* ((gio-info (gio-cleanup-info genum))
(callback-id (gio-cleanup-info-callback-id gio-info)))
(guarantee-gio-idle genum)
(C-callback "async_ready")
callback-id)
(let* ((queue (gio-queue genum))
- (value (thread-queue/dequeue! queue)))
+ (value (dequeue! queue)))
(if (string? value)
(begin
(set-gio-cleanup-info-pending-op! gio-info 'ERROR)
(make-ginfos genum))))))
(define (make-ginfos genum)
+ (assert-glib-locked 'make-ginfos)
(let* ((glist (gfile-enumerator-ginfos genum))
(scan (copy-alien glist))
(ginfo (make-alien '|GFileInfo|))
(C-> scan "GList data" ginfo)
(if (not (alien-null? ginfo))
(let ((new (make-gfile-info)))
- (without-interrupts
- (lambda ()
- (copy-alien-address! (gobject-alien new) ginfo)
- (C->= scan "GList data" 0)))
+ (copy-alien-address! (gobject-alien new) ginfo)
+ (C->= scan "GList data" 0)
(C-> scan "GList next" scan)
(cons new (loop)))
(begin
(C-> scan "GList next" scan)
(loop))))))))
- (without-interrupts
- (lambda ()
- (if (not (alien-null? glist))
- (begin
- (C-call "g_list_free" glist)
- (alien-null! glist)))))
+ (if (not (alien-null? glist))
+ (begin
+ (C-call "g_list_free" glist)
+ (alien-null! glist)))
ginfos))
(define (make-next-files-finish-callback ginfos queue gerror*)
(C-callback
(named-lambda (next-files-finish-callback source result)
+ (assert-glib-locked 'next-files-finish-callback)
(C-call "g_file_enumerator_next_files_finish" ginfos source result gerror*)
(if (and (alien-null? ginfos)
(not (alien-null? (C-> gerror* "* GError"))))
(%queue! queue #t))))))
(define (gfile-enumerator-close genum)
+ (assert-glib-locked 'gfile-enumerator-close)
(let ((ginfos (gfile-enumerator-ginfos genum)))
(gfile-close genum
(named-lambda (close-enumerator
(define (make-enumerator-close-finish-callback queue gerror*)
(C-callback
(named-lambda (enumerator-close-finish-callback source result)
+ (assert-glib-locked 'enumerator-close-finish-callback)
(if (fix:zero?
(C-call "g_file_enumerator_close_finish" source result gerror*))
(let ((message (%gerror-message gerror*)))
(cleanup-gio gio-info)))
(define (gfile-mount gfile)
+ (assert-glib-locked 'gfile-mount)
(let* ((gmountop (make-g-mount-operation))
(alien (gobject-alien gmountop))
(gio-info (gio-cleanup-info gmountop))
(queue (gio-queue gmountop))
(gerror* (gio-cleanup-info-gerror-pointer gio-info))
(callback-id
- (without-interrupts ;don't leak callback IDs
+ (without-interruption ;don't leak callback IDs
(lambda ()
(let ((id (make-mount-finish-callback queue gerror*)))
(set-gio-cleanup-info-pending-op! gio-info 'MOUNT)
(gobject-alien (gio-cleanup-info-gcancellable gio-info))
(C-callback "async_ready")
callback-id)
- (let ((value (thread-queue/dequeue! queue)))
+ (let ((value (dequeue! queue)))
(cond ((and (equal? value "Password dialog cancelled")
(g-mount-operation-ask-password-flags gmountop))
(set-gio-cleanup-info-pending-op! gio-info #f)
((eq? value #t)
(set-gio-cleanup-info-pending-op! gio-info #f)
(gobject-unref! gmountop)
- (without-interrupts
+ (without-interruption
(lambda ()
(cleanup-gio gio-info)))
unspecific)
(define (prompt-for-mount-auth gmountop)
(%trace-auth ";prompt-for-mount-auth "gmountop"\n")
+ (assert-glib-locked 'prompt-for-mount-auth)
(let ((message (g-mount-operation-message gmountop))
(domain (g-mount-operation-domain gmountop))
(username (g-mount-operation-username gmountop))
(port (interaction-i/o-port)))
(if message (display message port))
(if (and (memq 'ANONYMOUS-SUPPORTED flags)
- (prompt-for-confirmation "Login anonymously" port))
+ (without-glib-lock
+ (lambda ()
+ (prompt-for-confirmation "Login anonymously" port))))
(begin
(C-call "g_mount_operation_set_anonymous" alien 1)
(set-g-mount-operation-username! alien "anonymous")))
(C-call "g_mount_operation_set_username" alien (string->utf8 u))
(set-g-mount-operation-username! gmountop u)))
(if (memq 'NEED-PASSWORD flags)
- (call-with-pass-phrase
- "Password"
- (lambda (phrase)
- (C-call "g_mount_operation_set_password" alien (string->utf8 phrase)))))
+ (let ((password))
+ (dynamic-wind
+ (lambda () unspecific)
+ (lambda ()
+ (without-glib-lock
+ (lambda ()
+ (call-with-pass-phrase
+ "Password"
+ (lambda (phrase) (set! password (string->utf8 phrase))))))
+ (C-call "g_mount_operation_set_password" alien password))
+ (lambda ()
+ (bytevector-fill! password #x55)))))
(if (memq 'SAVING-SUPPORTED flags)
- (if (prompt-for-confirmation "Save password permanently" port)
+ (if (without-glib-lock
+ (lambda ()
+ (prompt-for-confirmation "Save password permanently" port)))
(C-call "g_mount_operation_set_password_save" alien
(C-enum "G_PASSWORD_SAVE_PERMANENTLY"))
- (if (prompt-for-confirmation "Save password for this session" port)
+ (if (without-glib-lock
+ (lambda ()
+ (prompt-for-confirmation "Save password for this session"
+ port)))
(C-call "g_mount_operation_set_password_save" alien
(C-enum "G_PASSWORD_SAVE_FOR_SESSION"))
(C-call "g_mount_operation_set_password_save" alien
(C-enum "G_PASSWORD_SAVE_NEVER")))))))
(define (prompt-for-string* prompt default port)
- (let ((s (prompt-for-string prompt port)))
+ (let ((s (without-glib-lock
+ (lambda ()
+ (prompt-for-string prompt port)))))
(if (not (string-find-next-char-in-set s char-set:not-whitespace))
default
s)))
(define (make-mount-finish-callback queue gerror*)
(C-callback
(named-lambda (mount-finish-callback source result)
+ (assert-glib-locked 'mount-finish-callback)
(if (fix:zero? (C-call "g_file_mount_enclosing_volume_finish"
source result gerror*))
(let ((message (%gerror-message gerror*)))
" "(c-peek-cstring user)
" "(c-peek-cstring domain)
" "(->ask-password-flags flags)"\n")
+ (assert-glib-locked 'mount-password-callback)
(let ((old (g-mount-operation-ask-password-flags gmountop))
(new (->ask-password-flags flags)))
(set-g-mount-operation-message! gmountop
" "gmountop
" "(c-peek-cstring message)
" "(peek-gstrv! choices)"\n")
- (warn "Unimplemented" 'mount-question-callback)))
+ (warn "Unimplemented" 'mount-question-callback)
+ (assert-glib-locked 'mount-question-callback)))
(define (peek-gstrv! alien)
(let loop ()
(define-method initialize-instance ((gfile <gfile>))
(call-next-method gfile)
+ (assert-glib-locked '(initialize-instance <gfile>))
(let ((alien (gobject-alien gfile))
(uri (string->utf8 (uri->string (gfile-uri gfile)))))
(set-alien/ctype! alien '|GFile|)
(define-method initialize-instance ((gcancel <gcancellable>))
(call-next-method gcancel)
+ (assert-glib-locked '(initialize-instance <gcancellable>))
(let ((alien (gobject-alien gcancel)))
(set-alien/ctype! alien '|GCancellable|)
(C-call "g_cancellable_new" alien)))
(define (make-cstringv setter)
;; SETTER is applied to an alien that must not escape.
+ (assert-glib-locked 'make-cstringv)
(let ((alien (make-alien '(* uchar)))
(copy (make-alien '(* uchar))))
(add-glib-cleanup alien (make-cstringv-cleanup copy))
(define (make-cstringv-cleanup alien)
(named-lambda (cstringv-cleanup)
+ (assert-glib-locked 'cstringv-cleanup)
(if (not (alien-null? alien))
(let ((scan (copy-alien alien))
(cstr (make-alien 'uchar)))
(cons str (loop)))))))
(define (free-cstringv alien)
- (without-interrupts
+ (without-interruption
(lambda ()
(execute-glib-cleanup alien)
(alien-null! alien))))