Can't make Document window visible by jassert


I’m making very simple application using JUCE 1.34, I’m facing a problem. I make a window which inherit DocumentWindow. But it will stop by jassert by calling setVisible(true). Are there anything missing in my code? In Mac OS X, it works fine but the problem only happens on Windows. And when I change the base class to ResizableWindow, it works fine on Windows.

Here is my code. “CMainPain” is a component class which is built by Jucer.

[code]#include “CMainPane.h”

// CMainWindow
class CMainWindow :
// public DialogWindow
public DocumentWindow
// public ResizableWindow
CMainWindow() :
//DialogWindow (T(“DM15Jig”), Colours::lightgrey, false)
DocumentWindow(T(“DM15Jig”), Colours::lightgrey, DocumentWindow::allButtons, true)
// ResizableWindow(T(“DM15Jig”), Colours::lightgrey, true)
setContentComponent(new CMainPane);
//setMenuBar (this, commandManager);
setResizable(true, false);
centreWithSize(700, 600);

	//	don't want the window to take focus when the title-bar is clicked..

virtual ~CMainWindow() { /*deleteAllChildren();*/ }

	Called when the close button is pressed. Just quit the application.
virtual void closeButtonPressed () { JUCEApplication::quit(); }


Here is a initialize function in my application.

[code] virtual void initialise(const String& commandLine)
static ShinyLookAndFeel mLook;

	// just create the main window...
	m_pMainWindow = new CMainWindow();

Anyone please help me.

Best regards,
Masanao Hayashi


I had a quick go with that code and it worked fine. Where is the assertion that’s failing?


In juce_component.cpp, line 3107,

#if JUCE_CATCH_UNHANDLED_EXCEPTIONS catch (const std::exception& e) { currentlyFocusedComponent = 0; Desktop::getInstance().triggerFocusCallback(); Here!>> JUCEApplication::sendUnhandledException (&e, __FILE__, __LINE__); } catch (...) { currentlyFocusedComponent = 0; Desktop::getInstance().triggerFocusCallback(); JUCEApplication::sendUnhandledException (0, __FILE__, __LINE__); } #endif

When I call m_pWindow->setVisible(true); in my initialise() in application class, then the code goes this assertion point…

Best regards,
Masanao Hayashi


…right - well if you’re getting an exception, turn on exception catching and you’ll be able to see what’s going wrong. Probably crashing somewhere in your CMainPane class, which I had to comment-out when I tried the code.


hmm… but the component CMainPain is just saved by the latest version of Jucer, it has two labels and one text button only. And the whole code works fine on Mac OS X… hmm…



Of course this could be a juce bug, but I can’t guess what’s causing the exception unless you can catch it happening.


Well, I sent whole source code of that project. Please investigate it if you have time.




I apologize… that’s my fault. I forgot to turn on the “Enable Run-Time Type Info” in the compiler settings…

Now it works fine.

Best regards,
Masanao Hayashi