Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: ColumnsUI panel does not get created in Release build (Read 1413 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

ColumnsUI panel does not get created in Release build

During release testing of Columns UI support for my component I hit a problem:

- The component gets registered correctly and recognized by Columns. I can even add a panel with my component but the create_or_transfer_window() method is never called (Established with good old fashioned printf debugging because the debugger is not available)

Obviously the Debug build works flawlessly (I think).

Does anybody know what causes this?

Re: ColumnsUI panel does not get created in Release build

Reply #1
Is the extension_base::get_extension_guid method correctly implemented (returning a stable GUID and not e.g. an uninitialised variable)? Are there multiple panels sharing the same extension GUID? Similarly, is the window::is_available method correctly implemented?

If it's not any of those, if you share a project that reproduces the problem I'm sure someone will be able to find the problem.
.

Re: ColumnsUI panel does not get created in Release build

Reply #2
Is the extension_base::get_extension_guid method correctly implemented (returning a stable GUID and not e.g. an uninitialised variable)? Are there multiple panels sharing the same extension GUID? Similarly, is the window::is_available method correctly implemented?

If it's not any of those, if you share a project that reproduces the problem I'm sure someone will be able to find the problem.
Thank you for reply. No, it's not any of those: static GUID variable, 1 panel, is_available() = true. Here is the wrapper I'm using:

CUIElement.h

Re: ColumnsUI panel does not get created in Release build

Reply #3
Looks like you're sharing a single GUID for DUI and CUI instances. Try separate ones.

edit: thinking about it, I doubt this is the issue but I've always done it. :P

edit2: looking at some old I code I had, maybe get_class_data needs to be implemented. But I would have expected you to have compile errors if it was really necessary??

Code: [Select]
		class_data& get_class_data() const override
{
__implement_get_class_data_ex(L"some unique class name here", L"", false, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, CS_DBLCLKS);
}








Re: ColumnsUI panel does not get created in Release build

Reply #4
Are you sure get_extension_guid isn't returning a dangling reference? Try changing GetGUID() to return a reference.
.

Re: ColumnsUI panel does not get created in Release build

Reply #5
Looks like you're sharing a single GUID for DUI and CUI instances. Try separate ones.

edit: thinking about it, I doubt this is the issue but I've always done it. :P

edit2: looking at some old I code I had, maybe get_class_data needs to be implemented. But I would have expected you to have compile errors if it was really necessary??

Code: [Select]
		class_data& get_class_data() const override
{
__implement_get_class_data_ex(L"some unique class name here", L"", false, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, CS_DBLCLKS);
}
Thx, marc but why does the Debug version work flawlessly then?

It must be something the compiler optimizes away in a Release build.

Re: ColumnsUI panel does not get created in Release build

Reply #6
Are you sure get_extension_guid isn't returning a dangling reference? Try changing GetGUID() to return a reference.
I tried that this morning based on your earlier suggestions. GetGUID() just returns a static GUID. It's shared code between DUI and CUI. DUI works in the Release build as usual.  Replacing it with the actual GUID did not help.

Code: [Select]
static GUID GetGUID() noexcept
    {
        static const GUID guid = GUID_UI_ELEMENT_SPECTOGRAM;

        return guid;
    }

And is the GUID also not used during registration in the CUI panel inventory? I can select it while modifying the layout. It's just the window that is not created.

Re: ColumnsUI panel does not get created in Release build

Reply #7
I tried that this morning based on your earlier suggestions. GetGUID() just returns a static GUID.
It doesn't – it's a static method that returns a GUID. That GUID is a copy of a static variable, but that's irrelevant because a copy is being made.

It's shared code between DUI and CUI. DUI works in the Release build as usual.  Replacing it with the actual GUID did not help.
The DUI method doesn't return a reference, while the CUI one does. Hence it doesn't matter if the GUID outlives the function with the DUI method. (The CUI one is a only reference for historical reasons.)

And is the GUID also not used during registration in the CUI panel inventory? I can select it while modifying the layout. It's just the window that is not created.
If the GUID is changing every time., then CUI won't be able to later locate your service and call it. Similarly, the name of the panel will be replaced with <unknown> in the layout tree. In a debug build the deinitialised memory is probably being filled with something like 0xDDDDDDDD, so it ends up working because it's constant.

In any case, I changed GetGUID to return a const GUID& and built your component. I was then able to add it to the layout in CUI without problem.
.

Re: ColumnsUI panel does not get created in Release build

Reply #8
Bottom line: rookie mistake. I always thought GUIDs were considered value types, not reference types.

Thx. for the help.