Search found 539 matches

by mael15
Mon Mar 18, 2024 11:01 am
Forum: C++ Development
Topic: wxGrid object's ref count assertion failed in multi-threading
Replies: 31
Views: 866

Re: wxGrid object's ref count assertion failed in multi-threading

How often do you get the warning? And is the call stack always the same? Unfortunately it´s just every now and then, maybe one in twenty. That is what makes it so difficult to analyze. It is possible that the issue is not directly related to your drawing code. If you can easily comment out the actu...
by mael15
Thu Mar 14, 2024 2:16 pm
Forum: C++ Development
Topic: wxGrid object's ref count assertion failed in multi-threading
Replies: 31
Views: 866

Re: wxGrid object's ref count assertion failed in multi-threading

Hi, As PB said - this is obviously and definitely wrong. All you do is the following: 1. In the thread create a payload of the data you want to paint. 2. Send wxThreadEvent with that payload to the GUI thread. 3. In the GUI thread wxThreadEvent handler get the payload and call Refresh. 4. In the GU...
by mael15
Thu Mar 14, 2024 2:06 pm
Forum: C++ Development
Topic: wxGrid object's ref count assertion failed in multi-threading
Replies: 31
Views: 866

Re: wxGrid object's ref count assertion failed in multi-threading

First thing to do is to get a call stack at the assert so you know what kind of object it is. They should help to narrow where is happens. Thanx, so I guess a wxFont is the issue? wxmsw322ud_core_vc_x64_custom.dll!wxRichMessageDialog::ShowModal() Zeile 88 wxmsw322ud_core_vc_x64_custom.dll!wxGUIAppT...
by mael15
Thu Mar 14, 2024 1:14 pm
Forum: C++ Development
Topic: wxGrid object's ref count assertion failed in multi-threading
Replies: 31
Views: 866

Re: wxGrid object's ref count assertion failed in multi-threading

I've never seen that as a real limitation. A custom paint event handler just draws data from a model. You can modify that model from threads if you protect it with a wxMutex/CriticalCondition. If the drawing itself is slow, there are usually ways to optimize it by caching some parts, or by other me...
by mael15
Thu Mar 14, 2024 12:54 pm
Forum: C++ Development
Topic: wxGrid object's ref count assertion failed in multi-threading
Replies: 31
Views: 866

Re: wxGrid object's ref count assertion failed in multi-threading

Thank you, but please answer my question about this from earlier: a) when you say don´t access GUI from outside the main thread, do you mean the gui that is currently displayed or any object that might be displayed in the current GUI at some point? This means any object that is in any way related t...
by mael15
Mon Mar 04, 2024 3:58 pm
Forum: C++ Development
Topic: wxGrid object's ref count assertion failed in multi-threading
Replies: 31
Views: 866

Re: wxGrid object's ref count assertion failed in multi-threading

And please repeat after me I! WILL! NOT! ACCESS! OR! OPERATE! ON! GUI! FROM! SECONDARY! OR! WORKER! THREAD! Thank you. Thank you, but please answer my question about this from earlier: a) when you say don´t access GUI from outside the main thread, do you mean the gui that is currently displayed or ...
by mael15
Mon Mar 04, 2024 1:47 pm
Forum: C++ Development
Topic: wxGrid object's ref count assertion failed in multi-threading
Replies: 31
Views: 866

Re: wxGrid object's ref count assertion failed in multi-threading

thank you both! it seems difficult to be precise? so here are very specific questions for wxMSW: a) when you say don´t access GUI from outside the main thread, do you mean the gui that is currently displayed or any object that might be displayed in the current GUI at some point? in this thread (http...
by mael15
Mon Mar 04, 2024 11:56 am
Forum: C++ Development
Topic: wxGrid object's ref count assertion failed in multi-threading
Replies: 31
Views: 866

Re: wxGrid object's ref count assertion failed in multi-threading

doublemax@work wrote: Mon Mar 04, 2024 11:28 am This is especially important for reference-counted objects.
Thank you! And where can I learn which objects exactly are reference-counted? If I know this, I know what to look for in my code.
For example: could wxGetColourFromUser return a reference counted object?
by mael15
Mon Mar 04, 2024 10:37 am
Forum: C++ Development
Topic: wxGrid object's ref count assertion failed in multi-threading
Replies: 31
Views: 866

Re: wxGrid object's ref count assertion failed in multi-threading

Anything GUI related is not. So when drawing inside threads, you're already walking on thin ice. That is what I would like to learn in detail: what means "anything GUI related" exactly? from the user perspective, wxFONTFAMILY_DEFAULT looks just like wxBLACK. When you say "walking on ...
by mael15
Mon Mar 04, 2024 9:19 am
Forum: C++ Development
Topic: wxGrid object's ref count assertion failed in multi-threading
Replies: 31
Views: 866

Re: wxGrid object's ref count assertion failed in multi-threading

Hi NEVER!!! NEVER!!! NEVER!!!! EVER!!! ACCESS!!! ANY!!! WXWIDGETS!!! CLASSES!!! FROM!!! ANY!!! THREAD!!! OTHER!!! THAN!!! MAIN!!! ONE!!! Thank you. is there a complete list of what is safe to use in threads and what is not? i do a lot of drawing in threads. as i understood it, for example using wxB...
by mael15
Thu Feb 08, 2024 3:47 pm
Forum: C++ Development
Topic: 0xC0000005 access violation outside my code
Replies: 3
Views: 310

Re: 0xC0000005 access violation outside my code

i actually use a simulated device from national instruments, thanx!
i have used it for ten years and did not have a problem until now, but now i know what part of my code to double check.

just to learn how to find it myself, how did you know what to google? is it the mxsout.dll?
by mael15
Thu Feb 08, 2024 2:37 pm
Forum: C++ Development
Topic: 0xC0000005 access violation outside my code
Replies: 3
Views: 310

0xC0000005 access violation outside my code

hi everyone, I do not know how to find the problem in my code. My app crashes after a few seconds, sometimes almost immediately sometimes after 5 seconds. the output console only shows an access violation Ausnahme ausgelöst bei 0x00007FFA5A3B433B (mxsout.dll) in ecInspector.exe: 0xC0000005: Zugriffs...
by mael15
Fri Dec 01, 2023 10:17 am
Forum: C++ Development
Topic: wxToolBarBase::AddControl works with reinterpret_cast, not with static_cast?!
Replies: 1
Views: 996

wxToolBarBase::AddControl works with reinterpret_cast, not with static_cast?!

hi, i have a wxPanel that contains 2 wxTextCtrl for the user to input coordinates class CoordsCtrl : public wxPanel, public wxControl when i add this to a wxToolBar, this works and shows the panel in the right location coordsXY = new CoordsCtrl(this); bool okay = AddControl(reinterpret_cast<wxContro...
by mael15
Mon May 08, 2023 8:32 am
Forum: C++ Development
Topic: keep wxTreeCtrl from resizing horizontally during Layout()
Replies: 2
Views: 320

keep wxTreeCtrl from resizing horizontally during Layout()

when i click on a wxTreeCtrl item, I need it to call Layout() on the parent, BUT I don´t want the wxTreeCtrl to resize horizontally to the width of the clicked item. So, a tree might look like this with some short text entries and some long ones: treeCtrl.gif When I click "odd {6}" it gets...
by mael15
Fri Apr 28, 2023 6:09 am
Forum: C++ Development
Topic: disable spacebar as wxControl trigger?
Replies: 7
Views: 834

Re: disable spacebar as wxControl trigger?

thank you, this answers my question, I will have to catch space bar events everywhere.