# SWI freezes when trying free XPCE objects (?)

**URL:** <https://swi-prolog.discourse.group/t/swi-freezes-when-trying-free-xpce-objects/9550>\
**Category:** Help!\
**Created:** [March 23, 2026, 10:37am UTC](https://swi-prolog.discourse.group/t/swi-freezes-when-trying-free-xpce-objects/9550 "2026-03-23T10:37:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmenier](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@gmenier](https://swi-prolog.discourse.group/u/gmenier)\
**Post date:** [March 23, 2026, 10:37am UTC](https://swi-prolog.discourse.group/t/swi-freezes-when-trying-free-xpce-objects/9550/1 "2026-03-23T10:37:12Z")

</div>

Hi !

I’m using: SWI-Prolog version 10.0.2 windows

I want the code to: open a dialog, show it and remove it.

But what I’m getting is: it freezes SWI (I have to kill it).

It works ok on SWI 9 (exact same code)

My code looks like this:

```prolog
?- use_module(library(pce)).
?- new(@demo, dialog('test')), send(@demo,open).
?- free(@demo). % freeze SWI PROLOG

```

G (new member, Hi 🙂 )

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [March 23, 2026, 5:42pm UTC](https://swi-prolog.discourse.group/t/swi-freezes-when-trying-free-xpce-objects/9550/2 "2026-03-23T17:42:52Z")

</div>

Thanks. Also crashes (rather than freezing) on MacOS ☹ . A work-around is to use

```
?- in_pce_thread(free(@demo)).

```

The threading model is much more restrictive in version 10 due to the use of the SDL graphics library. The above should normally not be a problem as freeing is normally called from the GUI thread as a result of event processing anyway. It should not crash this badly though ☹

---

<div class="post-metadata">

**Author:** ![gmenier](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@gmenier](https://swi-prolog.discourse.group/u/gmenier)\
**Post date:** [March 23, 2026, 7:31pm UTC](https://swi-prolog.discourse.group/t/swi-freezes-when-trying-free-xpce-objects/9550/3 "2026-03-23T19:31:41Z")

</div>

Many (many) thanks Jan !
