# window close button 64-bit not working

**URL:** <https://forum.xojo.com/t/window-close-button-64-bit-not-working/27866>\
**Category:** macOS\
**Created:** [November 6, 2015, 1:46pm UTC](https://forum.xojo.com/t/window-close-button-64-bit-not-working/27866 "2015-11-06T13:46:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boudewijn\_Krijger](https://forum.xojo.com/user_avatar/forum.xojo.com/boudewijn_krijger/32/591_2.png) [@Boudewijn\_Krijger](https://forum.xojo.com/u/Boudewijn_Krijger)\
**Post date:** [November 6, 2015, 1:46pm UTC](https://forum.xojo.com/t/window-close-button-64-bit-not-working/27866/1 "2015-11-06T13:46:23Z")

</div>

Odd behaviour; my App compiles and runs fine in both 64 bit and 32 bit.  
But closing the main window on the 64-bit version, causes a hang,  
whilst the 32-bit version closes and quit just fine.

App.open has autoquit = true and cancelclose has a quit.

Any ideas why the 64-bit behaves differently?

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [November 6, 2015, 1:50pm UTC](https://forum.xojo.com/t/window-close-button-64-bit-not-working/27866/2 "2015-11-06T13:50:12Z")

</div>

I suspect you’ve got an infinite loop by calling quit in CancelClose.

---

<div class="post-metadata">

**Author:** ![Boudewijn\_Krijger](https://forum.xojo.com/user_avatar/forum.xojo.com/boudewijn_krijger/32/591_2.png) [@Boudewijn\_Krijger](https://forum.xojo.com/u/Boudewijn_Krijger)\
**Post date:** [November 6, 2015, 1:51pm UTC](https://forum.xojo.com/t/window-close-button-64-bit-not-working/27866/3 "2015-11-06T13:51:56Z")

</div>

@Greg O’Lone : How could I just have an infinite loop when compiling 64-bit?

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [November 6, 2015, 2:24pm UTC](https://forum.xojo.com/t/window-close-button-64-bit-not-working/27866/4 "2015-11-06T14:24:42Z")

</div>

Please try it. It wouldn’t surprise me if calling Quit in CancelClose triggers another CancelClose event… or at least, don’t call Quit when AppQuitting=True

---

<div class="post-metadata">

**Author:** ![Boudewijn\_Krijger](https://forum.xojo.com/user_avatar/forum.xojo.com/boudewijn_krijger/32/591_2.png) [@Boudewijn\_Krijger](https://forum.xojo.com/u/Boudewijn_Krijger)\
**Post date:** [November 6, 2015, 3:19pm UTC](https://forum.xojo.com/t/window-close-button-64-bit-not-working/27866/5 "2015-11-06T15:19:32Z")

</div>

@Greg O’Lone : I tried a few variations and removing the close and cancelclose events from the App,  
and retaining a quit in the Main window’s CancelClose worked.

It’s a tad confusing but at least it quits now in both 32-bit and 64-bit.  
Thanks Greg

---

<div class="post-metadata">

**Author:** ![Roger\_Clary](https://forum.xojo.com/letter_avatar_proxy/v4/letter/r/eada6e/32.png) [@Roger\_Clary](https://forum.xojo.com/u/Roger_Clary)\
**Post date:** [November 6, 2015, 4:07pm UTC](https://forum.xojo.com/t/window-close-button-64-bit-not-working/27866/6 "2015-11-06T16:07:40Z")

</div>

As Greg has advised you, calling quit from cancelClose is not the correct construct. CancelClose needs to return a Boolean, then the app closes. By leaving it the way you have it, you are asking for more trouble down the road.

---

<div class="post-metadata">

**Author:** ![Sascha\_S](https://forum.xojo.com/user_avatar/forum.xojo.com/sascha_s/32/22328_2.png) [@Sascha\_S](https://forum.xojo.com/u/Sascha_S)\
**Post date:** [November 6, 2015, 4:46pm UTC](https://forum.xojo.com/t/window-close-button-64-bit-not-working/27866/7 "2015-11-06T16:46:42Z")

</div>

> [@227173:@Roger Clary](#):
>
> As Greg has advised you, calling quit from cancelClose is not the correct construct. CancelClose needs to return a Boolean, then the app closes. By leaving it the way you have it, you are asking for more trouble down the road.

I short words: just Return False in the CancelClose Event, to close the App 😉

Understand the CancelClose Event as a question “Cancel the close event?”. You return FALSE if you don’t want to cancel it. 🙂

---

<div class="post-metadata">

**Author:** ![Boudewijn\_Krijger](https://forum.xojo.com/user_avatar/forum.xojo.com/boudewijn_krijger/32/591_2.png) [@Boudewijn\_Krijger](https://forum.xojo.com/u/Boudewijn_Krijger)\
**Post date:** [November 7, 2015, 9:15am UTC](https://forum.xojo.com/t/window-close-button-64-bit-not-working/27866/8 "2015-11-07T09:15:36Z")

</div>

Thank you all for the replies, now I finally know the proper way to quit, I’m always thrown off by double negatives 😉

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:02pm UTC](https://forum.xojo.com/t/window-close-button-64-bit-not-working/27866/9 "2020-10-29T18:02:48Z")

</div>


