Search found 75 matches

by Ksawery
Sun Jun 07, 2020 10:53 am
Forum: C++ Development
Topic: Adding static text to wxMenuBar
Replies: 1
Views: 185

Adding static text to wxMenuBar

Hello, I'm developing an application with a top menu bar, along with some drop-down menus. This works fine, however I'd also like to use a part of the menu bar (ideally the top right corner) to display the system time. Is there any way to display (and periodically update) a wxStaticText, or some equ...
by Ksawery
Mon Apr 06, 2020 3:40 pm
Forum: Platform Related Issues
Topic: wxSound Noise
Replies: 1
Views: 282

Re: wxSound Noise

I'm using Audacity to convert my mp3 files to .wav, and I'm starting to suspect it of creating a file format that causes the popping noise in wxWidgets. I'm not sure what wave format wxWidgets uses, since every .wav file that I download or tried to convert online failed to work? Only files created i...
by Ksawery
Mon Apr 06, 2020 2:59 pm
Forum: Platform Related Issues
Topic: wxSound Noise
Replies: 1
Views: 282

wxSound Noise

Hello, I'm using the wxSound class for a short user notification, which loops in the background. However, at the start of every loop, when the app starts to play the sound file, there is a noticeable 'popping' noise, which is pretty loud. I've tried different sound files and different headsets/speak...
by Ksawery
Thu Mar 26, 2020 2:38 pm
Forum: C++ Development
Topic: Error when closing application.
Replies: 2
Views: 230

Re: Error when closing application.

Ok, I've found the problem, apologies for the long post, but it had me confused for a while. The memory location I was referring to in: mbMaster->mb_mapping->tab_input_registers[11] was not created correctly, and hence the pointer errors, coming from the external Modbus library. I'm not sure why the...
by Ksawery
Thu Mar 26, 2020 2:15 pm
Forum: C++ Development
Topic: Error when closing application.
Replies: 2
Views: 230

Re: Error when closing application.

Upon further investigation, it seems that these function calls - in the Thread loop - are causing the error when closing the app for some reason: if (ct != -1) { wxCriticalSectionLocker enter(mbMaster->mb_guard); mbMaster->mb_mapping->tab_input_registers[11] = modbus_read_input_bits(ctx, 10001, MB_N...
by Ksawery
Thu Mar 26, 2020 2:05 pm
Forum: C++ Development
Topic: Error when closing application.
Replies: 2
Views: 230

Error when closing application.

Hello, I'm writing a new mulithreaded application in wxWidgets, and I'm encountering a pointer/malloc error that I can't quite figure out. I'm not sure if the problem lies in my wxWidgets code, or the external library that I'm using. On starting my wxWidgets application, I create an additional threa...
by Ksawery
Sat Oct 19, 2019 2:40 pm
Forum: C++ Development
Topic: Delete thread with blocking function
Replies: 14
Views: 1196

Re: Delete thread with blocking function

I managed to find (what I hope is) a good solution to the problem, by following these recommendations: https://github.com/stephane/libmodbus/issues/452 I made the TCP/IP socket non-blocking, using the following function: fcntl(socket, F_SETFL, fcntl(socket, F_GETFL, 0) | O_NONBLOCK); This effectivel...
by Ksawery
Fri Oct 18, 2019 5:34 pm
Forum: C++ Development
Topic: Delete thread with blocking function
Replies: 14
Views: 1196

Re: Delete thread with blocking function

cough...cough... it's definitely not linux What do you mean, this is under Linux Mint, Eclipse IDE :D if your lib has internal threads and has not explicit functions kinda stop_lib, terminate... you must not try to stop something inside it. I don't think the library provides any way to interact wit...
by Ksawery
Fri Oct 18, 2019 1:57 pm
Forum: C++ Development
Topic: Delete thread with blocking function
Replies: 14
Views: 1196

Re: Delete thread with blocking function

Here are the threads running in the application: Temporary breakpoint 1, main (argc=1, argv=0x7fffffffddc8) at ../cPomiarWiazki.cpp:3 3 wxIMPLEMENT_APP(cPomiarWiazki); [New Thread 0x7fffeb904700 (LWP 3993)] [New Thread 0x7fffeb103700 (LWP 3994)] [New Thread 0x7fffea3f1700 (LWP 3996)] [New Thread 0x7...
by Ksawery
Fri Oct 18, 2019 1:41 pm
Forum: C++ Development
Topic: Delete thread with blocking function
Replies: 14
Views: 1196

Re: Delete thread with blocking function

I still get the following message, despite using Kill(): 15:41:27: Debug: 1 threads were not terminated by the application. So I guess I can't do anything until the blocking function returns? Im undertand though, that the thread is terminated, and the heap resources are freed anyway, when the app cl...
by Ksawery
Fri Oct 18, 2019 1:13 pm
Forum: C++ Development
Topic: Delete thread with blocking function
Replies: 14
Views: 1196

Re: Delete thread with blocking function

I use the following code to terminate the thread: //Delete TCP/IP thread { wxCriticalSectionLocker enter(mbThreadCS); if (mbThreadTCP) { if (mbThreadTCP->Kill() != wxTHREAD_NO_ERROR) wxLogError("Can't delete the thread!"); } } while (1) { { wxCriticalSectionLocker enter(mbThreadCS); if (!mbThreadTCP...
by Ksawery
Fri Oct 18, 2019 12:54 pm
Forum: C++ Development
Topic: Delete thread with blocking function
Replies: 14
Views: 1196

Delete thread with blocking function

I currently have a function to delete and clean up all my threads when the application is closed (i'm using 3 wxThreads). Unfortunately one of the threads uses a blocking function call for incoming TCP/IP communication. The function will not return until communication is established, so in the case ...
by Ksawery
Fri Oct 18, 2019 10:52 am
Forum: C++ Development
Topic: "Main thread" vs. other threads
Replies: 30
Views: 2467

Re: "Main thread" vs. other threads

Ah, might be problem with a non-existent pointer...
by Ksawery
Fri Oct 18, 2019 10:44 am
Forum: C++ Development
Topic: "Main thread" vs. other threads
Replies: 30
Views: 2467

Re: "Main thread" vs. other threads

I have a new issue, where my App crashes on triggering one of the events. On each itteration of my worker thread, I send events to one of the "main" windows, as well as an additional "diagnostics" window (which is tied to the same main window), under the condition that it is opened by the user: //Se...
by Ksawery
Thu Oct 17, 2019 1:43 pm
Forum: C++ Development
Topic: "Main thread" vs. other threads
Replies: 30
Views: 2467

Re: "Main thread" vs. other threads

Sorry, turns out it was a simple error in not resetting a counter, and trying to access an invalid memory location. I will continue to test the application, hopefully it will work well now :)

Regards,
Ksawery