Component bug? Internal repaint error


#1

Hello all.

There's a strange error coming up when using Visual Basic 2013. Breakpoint:

void Component::repaint (const Rectangle<int>& area)
{
    internalRepaint (area);
}

Call stack:


zenit2.exe!juce::Component::repaint(const juce::Rectangle<int> & area) Line 1878    C++
zenit2.exe!juce::ResizableWindow::activeWindowStatusChanged() Line 254    C++    zenit2.exe!juce::DocumentWindow::activeWindowStatusChanged() Line 350    C++    zenit2.exe!juce::DocumentWindow::lookAndFeelChanged() Line 338    C++

zenit2.exe!juce::DocumentWindow::DocumentWindow(const juce::String & title, juce::Colour backgroundColour, int requiredButtons_, bool addToDesktop_) Line 63    C++

zenit2.exe!zenit2Application::MainWindow::MainWindow(juce::String name) Line 38    C++

I've disabled (commented out) all of my code from the prgroam so just Main and Main Component are left so none of that is included in the build.

I hope I've provided the correct data to solve this, please request if anything more is needed. Apologies if this is a very obvious thing, still very much beginner!





 


#2

This program still runs perfectly well when run without debugging with no stalls on start-up, use or close.


#3

Hello!  I assume you mean Visual Studio rather than Visual Basic.

Firstly, you should make sure your version of JUCE is up to date.

If you've done that, a minimal example would help us work out what the problem is: minimal being the keyword. A good way to share such examples is via Github.

If you're getting strange behaviour that changes between build configurations, you may well be in the realms of undefined behaviour.

Hope this helps!


#4

I do indeed mean Visual Studio haha!

Juce is up to date.

Below is all the code that's being compiled as everything branches from the GUI component which has been commented out. 

Main.cpp:

#include "../JuceLibraryCode/JuceHeader.h"
#include "MainComponent.h"
class zenit2Application  : public JUCEApplication
{
public:
    zenit2Application() {}
    const String getApplicationName() override       { return ProjectInfo::projectName; }
    const String getApplicationVersion() override    { return ProjectInfo::versionString; }
    bool moreThanOneInstanceAllowed() override       { return true; }
    void initialise (const String& ) override
    {
        mainWindow = new MainWindow (getApplicationName());
    }
    void shutdown() override
    {
        mainWindow = nullptr;
    }
    void systemRequestedQuit() override
    {
        quit();
    }
    void anotherInstanceStarted (const String& ) override
    {
    }
    class MainWindow    : public DocumentWindow
    {
    public:
        MainWindow (String name)  : DocumentWindow (name,
                                                    Colours::lightgrey,
                                                    DocumentWindow::allButtons)
        {
            setUsingNativeTitleBar (true);
            setContentOwned (new MainContentComponent(), true);
            centreWithSize (getWidth(), getHeight());
            setVisible (true);
        }
        void closeButtonPressed() override
        {
            JUCEApplication::getInstance()->systemRequestedQuit();
        }
    private:
        JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)
    };
private:
    ScopedPointer<MainWindow> mainWindow;
};
START_JUCE_APPLICATION (zenit2Application)

Main Component.h:


#ifndef MAINCOMPONENT_H_INCLUDED
#define MAINCOMPONENT_H_INCLUDED
#include "../JuceLibraryCode/JuceHeader.h"
//#include "GUI.h"
class MainContentComponent   : public Component
{
public:
    MainContentComponent();
    ~MainContentComponent();
    void paint (Graphics&);
    void resized();
private:
    //GUI gui;
    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent);
};
#endif

Main Component.cpp:


#include "MainComponent.h"
MainContentComponent::MainContentComponent()
{
    setSize (600, 400);
    //addAndMakeVisible(gui);
}
MainContentComponent::~MainContentComponent()
{
}
void MainContentComponent::paint (Graphics& g)
{
    g.fillAll (Colour (Colours::black));
}
void MainContentComponent::resized()
{
}