‎2024-11-06 08:37 AM
Hi,
In fixing a crash issue involving our implementation of a `DG::Palette` I found this post in a forum thread: How-to-make-a-Palette-dialog-by-C-Class , which helped me solve my issue... except, building for Archicad 24 and below fails.
It turns out that the header file `Support/Modules/GSRoot/DisposableObject.hpp` does not exist in the Archicad dev kit prior to version 25.
I downloaded the development kits for versions 25, 24 and 23 to see if there might be mention of how one is supposed to implement this Palette dialog in versions before 25. However, I found that the documentation in both version 24 and 23 mentions both `DisposableObject` and `DisposeHandler` in e.g. the description of `APIPaletteControlCallBackProc`.
Is the documentation for these old versions ahead of time, or are files missing from the SDK in these older versions?
And last but not least: Can we somehow get our code to compile (and work) the way it is now, or do I have to do a version split so that we do it the way we used to do for versions <25 and the "fixed way" on versions 25+?
--
Kind regards
Steffen Skov
dRofus
‎2024-11-12 02:50 PM
Hi Steffen,
There are other similar ways to make a DG::Palette without the DisposableObject class. I never used the DisposableObject class and from giving a quick look at the example I'm not yet convinced about any major benefits from it.
If I remember correctly, I started with the "DG_Test/OwnerDrawnListBoxPalette" example to get started with Palettes. This is already available in AC24 and I got it to work across several API/AC versions.
Hope that helps,
Bernd
‎2024-11-14 10:21 PM
Thank you, Bernd!
This helped me on my way. I have now tested with both Archicad 22 and 27, and it seems to work wonderfully! Fingers crossed that the success continues with 28.
--
Kind regards
Steffen Skov
dRofus
4 weeks ago
A little update on the issue here.
I had to "unaccept" the accepted solution, as it turned out that avoiding the `DisposableObject` approach crashed in Archicad 28.
In our code base, not utilizing `DisposableObject` worked for Archicad versions up to and including 27, but with 28 it does not work without it.
My solution has been to define conditional compilation so that when we build for pre-28 versions we exclude the `DisposableObject` parts, and include them when building for version 28.
--
Kind regards
Steffen Skov
dRofus
3 weeks ago
Hi Steffen,
I haven't run into this issue yet for AC28. Do you have any insights why the crash is happening without DisposableObject? So us other developers can prepare as well 🙂
Best,
Bernd
3 weeks ago
Hi Bernd,
I realize that I in fact did not specify the steps to make it crash.
Just creating and displaying the panels work nicely with or without the use of `DisposableObject`, but when we close the panels it crashes in AC28 if we do not utilize the `DisposableObject` class.
As for the "why?", I am clueless I must admit. If I remember correctly the call stack was deep into Archicad territory, so not much info to gather.
--
Kind regards
Steffen Skov
dRofus
3 weeks ago - last edited 3 weeks ago
Thanks Steffen for the clarification! 🙂
My first thought is, that it might be related to the new memory allocators in AC28.
I'll play around more when I have time to see if I can trigger a crash in my Add-Ons as well.
Best,
Bernd
2 weeks ago
I added a comment to the https://community.graphisoft.com/t5/Archicad-C-API/Modeless-Palette-ac28/m-p/642735#M10020 page, please check it, there are few words about DisposableObject also.
2 weeks ago
Thank you Miklos,
For the newer versions of Archicad I ended up using the `DisposableObject` approach, so that in and of itself is not a problem.
What puzzled me though was that, while the `DisposableObject` was mentioned in examples even in the Archicad 22 SDK, I could not get it to compile because the header file(s) for that class was not included in the SDK. If my memory serves me right those file would only be available in the SDK for Archicad 25 and later.
--
Kind regards
Steffen Skov
dRofus