Commit af8de280 authored by Marcus Nordenberg's avatar Marcus Nordenberg Committed by Claes Sjöfors

xtt: Fix subwindow segfault when updating context

parent fbc0a781
...@@ -4156,9 +4156,14 @@ void GlowDrawGtk::pop_customcolors() ...@@ -4156,9 +4156,14 @@ void GlowDrawGtk::pop_customcolors()
{ {
if (customcolors_cnt <= 0) { if (customcolors_cnt <= 0) {
printf("** Customcolor stack disorder\n"); printf("** Customcolor stack disorder\n");
return;
} }
for (int i = 0; i < customcolors_cnt - 1; i++) for (int i = 0; i < customcolors_cnt - 1; i++)
{
customcolors[i] = customcolors[i + 1]; customcolors[i] = customcolors[i + 1];
customcolors[i + 1] = NULL;
}
customcolors_cnt--; customcolors_cnt--;
} }
......
...@@ -789,12 +789,13 @@ int GrowWindow::update_attributes() ...@@ -789,12 +789,13 @@ int GrowWindow::update_attributes()
if (window_ctx) { if (window_ctx) {
if (window_ctx->trace_started) if (window_ctx->trace_started)
window_ctx->trace_close(); window_ctx->trace_close();
ctx->gdraw->pop_customcolors();
delete window_ctx; delete window_ctx;
fill_drawtype = original_fill_drawtype = glow_eDrawType_Inherit; fill_drawtype = original_fill_drawtype = glow_eDrawType_Inherit;
fill = 0; fill = 0;
} }
strcpy(file_name, input_file_name); strcpy(file_name, input_file_name);
new_ctx(); new_ctx(true);
sts = 1; sts = 1;
ctx->gdraw->reset_clip_rectangle(&ctx->mw); ctx->gdraw->reset_clip_rectangle(&ctx->mw);
...@@ -923,7 +924,7 @@ void GrowWindow::h_value_changed_cb(void* o, double value) ...@@ -923,7 +924,7 @@ void GrowWindow::h_value_changed_cb(void* o, double value)
gw->draw(); gw->draw();
} }
void GrowWindow::new_ctx() void GrowWindow::new_ctx(bool is_updating_attributes)
{ {
char fname[200]; char fname[200];
int sts; int sts;
...@@ -977,6 +978,9 @@ void GrowWindow::new_ctx() ...@@ -977,6 +978,9 @@ void GrowWindow::new_ctx()
strcpy(window_ctx->owner, owner); strcpy(window_ctx->owner, owner);
window_ctx->customcolors = ctx->gdraw->create_customcolors(); window_ctx->customcolors = ctx->gdraw->create_customcolors();
if (is_updating_attributes)
ctx->gdraw->push_customcolors(window_ctx->customcolors);
if (!no_file) { if (!no_file) {
window_ctx->set_nodraw(); window_ctx->set_nodraw();
sts = window_ctx->open(fname, glow_eSaveMode_Edit); sts = window_ctx->open(fname, glow_eSaveMode_Edit);
......
...@@ -278,7 +278,7 @@ public: ...@@ -278,7 +278,7 @@ public:
int update_attributes(); int update_attributes();
//! Create a new grow context //! Create a new grow context
void new_ctx(); void new_ctx(bool is_updating_attributes = false);
// Configure the scrollbars // Configure the scrollbars
void configure_scrollbars(); void configure_scrollbars();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment