Timeout stopped working for me with Duktape v2.7.0 - duktape

I had timeouts working nicely with Duktape v2.5.0.
In my duktape.h file, I appended:
#define DUK_USE_EXEC_TIMEOUT_CHECK JSduk_timeout_check // our timeout check function
duk_bool_t JSduk_timeout_check(void *udata);
and in the function do the checking of time and return 1 if the time has been exceeded, else 0.
It was working fine.
I have discovered that since updating to Duktape v2.7.0 it is no longer working.
I have remembered to append the same two lines to the duktape.h file.
But the function never gets called.
What am I missing, please?
MacOS Ventura M2 processor
I have put a trace in the function and also set a breakpoint using Xcode but it definitely is not being called.
The is no problem compiling and linking.

Found my problem... I had forgotten to set
#define DUK_USE_INTERRUPT_COUNTER
which I had previously in the duk_config.h file and which I overlooked updating.
I have now inserted this #define along with the other stuff in the duktape.h file, where it should not be overlooked.

Related

CImage::Save caused error Thread 0x**** has exited with code 1 (0x1)

I'm working on a small app on Windows.
It uses CImage to write a PNG file on disk.
It just goes like this:
CImage theImage;
...
theImage.Save("D:\\xxx.png");
After the file was written on the disk and I clicked the close button on the top-right corner to exit the program. The console showed me a message like this:
Thread 0x**** has exited with code 1 (0x1)
Program "[*****] xxx.exe" has exited with code 0 (0x0).
Code 0x1 should indicate an error, right? Seems something wrong happened when the thread created by CImage::Save was writing the file.
The image file is perfectly on the disk, nothing wrong with it. And I checked the return value of Save, it also indicated success.
I have walked through all my code and I'm sure it is definitely caused by the invocation of CImage::Save, if I don't call it, this message never pops up. That is, the console would look like this:
Program "[*****] xxx.exe" has exited with code 0 (0x0).
I did some search and I found this post, but they didn't work it out either.
Even though the program didn't crash, but this message still annoys me.
Any idea? Thanks a lot.
"Code 0x1 should indicate an error, right?"
Only in the most abstract meaning of 'error'. Whoever authored the creation and destruction of the thread decided what value to return, and what that value meant. Could be that someone used some library that required cleanup which didn't get done in time, or another of 1000 possible causes. Not something to spend time on.

Support for em-dash in Windows file paths using StgOpenStorage()

I had a customer reporting problems with a file in a specific path. Debugging some old Windows code, I have found that the code in question that fails is a call to StgOpenStorage(). The path in question that fails has an em-dash. If I take this em-dash out by renaming the file, then the call to StgOpenStorage() succeeds.
So my question is this: is this a known limitation with this function? Are there likely to be other Windows SDK functions that fail with special characters like em-dash? I noticed there is a call to mbstowcs() prior to calling this function, which makes me wonder if the problem is due to the code-page mapping the em-dash character incorrectly. The wchar path looks okay in the Visual Studio debugger prior to the call, so it seems weird that the function would fail on a path that the system allows.
You were right Roger Rowland, it was due to the active locale prior to the call to mbstowcs(). I fixed this problem by calling:
setlocale( LC_ALL, "" );
Prior to the call to mbstowcs(). It looks like for some reason the "C" locale doesn't support em-dash, as if I set this instead it fails:
setlocale( LC_ALL, "C" );
My regional settings are set to English (Australia).
Cheers.

Xcode Instruments - Leaks are shown in the wrong function

My app seems to be leaking some allocations, at least instruments says so, but it points me to the wrong line of code.
The stack trace in the image bellow, says that btAllignedAllocDefault is leaking, but it is just a fancy malloc, so the offending line of code must be in initEngine, the problem is that double-ckicling initEngine shows the file containing iniEngine's definition but always point to some arbitrary line in the first function definition it finds in that file.
No mather where I put the supposed offending function initEngine(), Instruments points to some arbitrary line of code always in the first function it finds in the file that contains the offendig code.
I tryied deleting all the DerivedData, and building both the Release and Debug build configurations.
I've noticed, though, that Xcode never puts the .app bundle and .dSYM file in Debug-iphoneos, but always in Release-iphoneos, even when the Build location settings tell it to do so.

Loadframe Fails at CreateEx for no apparent reason in CMainFrame

Okay so my MFC application was working fairly well until I cleared the application from the system registry. Now I am unable to run the program. Whenever I try running the program I get an exception. Checking the stack I noticed that CreateEx in LoadFrame for CMainFrame was crushing. This crash occurs when ProcessShellCommand is called in the derived CwinApp of the application.However, I have not been able to pinpoint the exact cause of the crash. I have a hunch it might have something to do with the loading of resource but I don't know exactly how. I have checked the .rc include file and it looks fine to me. I just don't understand how clearing the registry could cause such a mess. Been at it for the past 4 hours.
So basically I am asking if any of you have faced this problem before, and how did you managed to fix it without starting right from scratch? I am not sure of the exact part of the code I should put here to clarify my question so I hope this is clear enough.
Thanks

How to fix me51n user exit EXIT_SAPLMEREQ_010?

I have problem with me51n. I have an include in EXIT_SAPLMEREQ_010 that has a bunch of codes which we use it to receive errors. The problem of mine is;
-When i run me51n with required datas(mat. number, quantity, etc.) I get some errors which also includes the error that I'm expecting on the first time, however when i terminate me51n and run it again with the same exact data, i dont get my error. I have debugged it and put a break point on my include in EXIT_SAPLMEREQ_010 and it never gets to my breakpoint on the second run. (It gets to the breakpoint on the first run but not the second one).
I dont know how but with the same material it works fine later again at the first time but still on the second time i cant get the error again.
Can anyone please help me on this?
Basically problem was the developement system from the beginning (sigh -_-). While having other errors rather than my errors, i assume my error gets stuck sometimes and never pop up because of the standard SAP procedure. So in test system (QA) me51n works perfectly when I'm just trying to have only my error.
Thanks for anyone who actually tried to help and I hope this might be useful sometime for someone in future.
Talha

Resources