DialogWindow memory allocation error


#1

Hi all,

I'm using a DialogWindow to load a component that at certain point has to access a SQLite database.

When the component tries to access the database, it gives me memory allocation error.

I'm calling the component this way:

 

String m;
m << "";

DialogWindow::LaunchOptions options;

Label* label = new Label();
label->setText(m, dontSendNotification);
label->setColour(Label::textColourId, Colours::darkgrey);
options.content.setOwned(label);
Rectangle<int> area(0, 0, 378, 407);

options.content->setSize(area.getWidth(), area.getHeight());
options.dialogTitle = "Login Window";
options.dialogBackgroundColour = Colours::darkgrey;
options.componentToCentreAround;
options.escapeKeyTriggersCloseButton = true;
options.useNativeTitleBar = false;
options.resizable = false;

DialogWindow* dw = options.launchAsync();
dw->setContentOwned(showLoginPage(), true);
dw->setVisible(true);
dw->centreWithSize(378, 407);

I know that to call the DialogWindow i'm creating a label that will not be used. But i did not find a way to put the content of the component before DialogWindow* dw.

If anyone have a better way to do it, it was good to know.

What could be the solution to load the component but with dinamic memory allocation ?

Or should i use a diferent type of window ?

Thanks,

Paulo


#2

Is this a duplicate question?

http://www.juce.com/forum/topic/dialogwindow-and-contentowned

This is considered cross-posting and is poor forum etiquette. Please post your question in a single thread. Cross-posting is often considered spamming, and you could get banned.


#3

Hi Matty,

far from my idea or dreams to put the same question twice. Even before i put the question i search over and over the forum for a answer to my problems and do many test on some solutions in similar problems.

The situation i am asking for help even its related with DialogWindow that i already had questioned about the close button on the component, it's related with the component itself that uses a connection to a dabatase, and when it does it, it give me memory allocation error.

I believed that, since this is a new situation, that i needed to ask for help in another post.

And i posted the code i am using to call this component, because perahps the problem was on the way i was doing it..

Sorry if i thinked on wrong way.

Paulo


#4

You posted the same section of code THREE times:

http://www.juce.com/forum/topic/dialogwindow-and-contentowned

http://www.juce.com/forum/topic/dialogwindow-memory-allocation-error

http://www.juce.com/comment/302337#comment-302337

In this case, you should probably just have combined all of your questions into one post. It's fine to ask a few different questions in one post if you are asking about the same topic--and all three of these posts are asking about DialogWindow.

It has nothing to do with your intentions, which I'm sure were good! People are much more likely to help you out if you are polite and follow good forum etiquette.