Irrlicht Mac OS X crash - c++

I'm trying to get Irrlicht running on Mac OS X, but when I try to run the "Demo" project, I see a screen with some options, but as soon as I click something, I get a lldb error for the following line of code:
[Window setIsVisible:FALSE];
It's line 554 of file CllrDeviceMacOSX.mm, and it gives this error in about every example I try to run
My system:
MacBook Pro Retina late 2012
Mac OS X 10.9 Mavericks

It appears that the NSWindow object Window is being released before the call to [Window setIsVisible:FALSE];.
Looking at Apple's documentation (NSWindow isReleasedWhenClosed) this is the expected behaviour as by default NSWindow objects are automatically released when closed.
As a workaround add:
[Window setReleasedWhenClosed:FALSE];
after the Window = [[NSWindow alloc]..... calls in CllrDeviceMacOSX.mm (there are two of them). I do not know enough about Irrlicht to know if this is a valid fix.

Related

Realtime desktop capturing Mac OS X Mojave and X11

I'm working on project which streams desktop image from Mac OS X computer to iOS device in realtime. My main problem is the screen capture. I'm not allowed to use ready libraries, which allow to write some lines of code in 5 mins and stream video over the World.
I've found a really good thing on GitHub which gets image of the whole screen using X11 and C++ :
https://github.com/Butataki/cpp-x11-make-screenshot
I've tested this code on my Ubuntu and everything works like a charm : it takes about 12ms just to capture 1 frame without saving data, and about 25ms with encoding to .jpg and saving on the disk.
To be able to build it, I've had done this :
$ sudo apt install libjpeg-dev libpng-dev libx11-dev
, changed 'true' to 'TRUE' in those lines :
//(screenshot.cpp : 232,233 lines)
jpeg_set_quality (&cinfo, quality, TRUE);
jpeg_start_compress(&cinfo, TRUE);
and changed Z_BEST_COMPRESSION to PNG_Z_DEFAULT_COMPRESSION
The problem is that I did almost the same operations in my XCode (Mac OS Mojave 10.14), downloaded and linked all necessary libraries, ran executable and finally....I got a blank image. No errors occured, everything works 'fine' and saves .jpg image in my folder on desktop.
Then I figured out that X11 has a something called the 'root window', which covers all of the desktop and you can just find this window and capture everyting on your screen. But I think it's true for Ubuntu, not for my Mac.
Actually, there is something about 'root window' in this article, but I just can't fix anything :
https://finkers.wordpress.com/running-x11/#intro.rootless
P.S If it's not a good way, maybe there are some another ways to acomplish my task (realtime screencapturing on Mac OS)?

QVTKWidget SetRenderWindow() with PCLVisualizer Exception

I'm new in PCL. I want to build a project with PCL and VTK int Qt 5.9.6 MSVC 2017 64bit Environment.
My code is like this:
// include file
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer;
...
// source code file
viewer.reset(new pcl:visualization::PCLVisualizer("viewer", false));
ui->qvtkWidget->SetRenderWindow(viewer->getRenderWindow());
viewer->setupInteractor(ui->qvtkWidget->GetInteractor(), ui->qvtkWidget- >GetRenderWindow());
It can be compiled but when I started debugging it goes wrong with alert:
The inferior stopped because it triggered an exception.
Stopped in thread 0 by: Exception at 0x7ffcb50b1f28, code: 0xc0000005: read access violation at 0x25, flags=0x0 (first chance).
and stopped at lineui->qvtkWidget->SetRenderWindow(viewer->getRenderWindow());
After tracking and debugging, I found the problem is that viewer->getRenderWindow()->GetInteractor() get the 0x25 value, I don't know how that could happen because a lot of online examples use code like this. And the same program runs healthy on ubuntu 18.04.
Thanks for any tips.
In the end, I found out that this is a problem caused by the version of VTK. The original version is 8.1.1, and it can be run normally by switching to 8.0.1. But I don't know why it can still be debugged normally in Linux 8.1.1.

Qt Creator and MSVC - Ignoring specific exception types on debugging?

I'm currently using Qt Creator 4.4.1 with Qt 5.9.2 and the MSVC 2015 32/64 Bit compilers to create a DLL on Windows 7.
In Qt Creator under
Projects -> Build & Run -> Desktop Qt 5.9.2 MSVC2015 xxbit -> Run -> Executable
I've specified the host application, that loads my DLL, so when I hit F5 this app gets executed and loads my DLL without a flaw.
However, on loading, the main app raises an exception which I have no hands-on, making Qt Creator showing up a message box with the following content:
The inferior stopped because it triggered an exception.
Stopped in thread 0 by: Exception at 0x60251637, code 0xc0000005: write access violation at: 0x1, flags=0x0 (first chance).
I now have to close the message box and hit F5 again to proceed.
Because I have to do this for every test run, again and again, it becomes really annoying. So, is there a simplest way to tell CDB from Qt Creator to ignore only that specific type of exception?
Look at the call stack, find the relevant code and see what it does. You should find a try ... catch ... around that line. See whether you can avoid the exception in some way, typically by introducing an if ... else ....
If you cannot avoid it, and you made sure it's really safe to ignore it, start CDB with command line argument -c "sxn c0000005" or the equivalent -c "sxn av", where AV is short for "access violation". You can use sx to see all exception settings.
I encountered the same problem, the problem may be caused by the variable is not initialized, for example:
QLable *lable;
If you forget to allocate memory for this variable, it will cause this error.
lable = new QLable(this);
I think you should check your variables.

QSystemtrayicon: no image on Mac

I've got a problem with the QSystemTrayIcon class on Mac and Linux.
I made a program creating a System tray icon, and I have no problem on Windows, but under Linux (ubuntu 12) and Mac (OSX 10.8), the tray icon is here, but the image on it doesn't show up.
This is what I'm doing in the ctor of my class:
icon = new QIcon("trayIcon.png");
m_pTrayIcon = new QSystemTrayIcon();
m_pTrayIcon->setIcon(*icon);
m_pTrayContextMenu = new QMenu();
m_pTrayContextMenu->addAction(openSettings);
m_pTrayContextMenu->addAction(switchSyncMode);
m_pTrayContextMenu->addAction(openFolder);
m_pTrayContextMenu->addSeparator();
m_pTrayContextMenu->addAction(quit);
m_pTrayIcon->setContextMenu(m_pTrayContextMenu);
m_pTrayIcon->show();
I'm using the Qt 4.8 library.
Anyone have an idea?
Two possibilities
It cannot find the file. Try what happens if you give the global path.
It cannot load the png; see if loading QT module Multimedia helps.

Simplecrypt lets my QT application crash on OS X Mountain Lion but works perfect on Windows

I'm using Simplecrypt to encrypt and decrypt some basic stuff in my QT application (c++).
On Windows 7 everything compiles fine and works like expected.
On Mac OS X Mountain Lion, the app crashes with the following error during launch:
ASSERT: "i >= 0 && i < size()" in file
./../QtSDK/Desktop/Qt/4.8.1/gcc/include/QtCore/qbytearray.h, line 414
The program has unexpectedly finished.
It does compile, but the precompiler gives me some errors about OS X Mountain Lion. I have no idea if this has something to do with it:
../../QtSDK/Desktop/Qt/4.8.1/gcc/include/QtCore/qglobal.h:328:6: warning: #warning "This version of Mac OS X is unsupported"
Is it possible to get Simplecrypt to work on Mac OS X Mountain Lion?
Thanks for looking into this!
Regarding ASSERT, it seems to be an out of array exception not catch when using a QByteArray.
What is the line of YOUR code that is causing the crash? Have you try to debug to see what happens?
The warning during precompilation only indicates that Qt 4.8 does not support MacOS X Mountain Lion so some bugs and unwanted behavior can happen.