Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always ref-sink after g_object_new() if the type inherits from GIniti… #484

Merged
merged 1 commit into from May 13, 2019

Conversation

Projects
None yet
2 participants
@sdroege
Copy link
Member

commented May 12, 2019

…allyUnowned

Independent of it still being actually floating or not.

Fixes #483

@sdroege sdroege referenced this pull request May 12, 2019

Closed

Object::new() bug #483

@@ -882,7 +882,7 @@ impl Object {
let ptr = gobject_sys::g_object_newv(type_.to_glib(), params_c.len() as u32, mut_override(params_c.as_ptr()));
if ptr.is_null() {
Err(glib_bool_error!("Can't instantiate object"))
} else if gobject_sys::g_object_is_floating(ptr) != glib_sys::GFALSE {
} else if gobject_sys::g_type_is_a(type_.to_glib(), gobject_sys::g_initially_unowned_get_type()) != glib_sys::GFALSE {

This comment has been minimized.

Copy link
@antoyo

antoyo May 12, 2019

Member

Could we do something like:

type_.is_a::<glib::object::InitiallyUnowned>()

?

This comment has been minimized.

Copy link
@sdroege

sdroege May 12, 2019

Author Member

Yes, does that work?

This comment has been minimized.

Copy link
@antoyo

antoyo May 12, 2019

Member

I don't know. I can try it if you want.

This comment has been minimized.

Copy link
@antoyo

antoyo May 12, 2019

Member

The following works:

type_.is_a(&glib::object::InitiallyUnowned::static_type())

This comment has been minimized.

Copy link
@sdroege

sdroege May 13, 2019

Author Member

Thanks, updated :)

@sdroege sdroege force-pushed the sdroege:object-new-floating-bullshit branch from ccbedc2 to c47381a May 13, 2019

@sdroege

This comment has been minimized.

Copy link
Member Author

commented May 13, 2019

Will merge once the CI is through

@antoyo

antoyo approved these changes May 13, 2019

Always ref-sink after g_object_new() if the type inherits from GIniti…
…allyUnowned

Independent of it still being actually floating or not.

Fixes #483

@sdroege sdroege force-pushed the sdroege:object-new-floating-bullshit branch from c47381a to 665b910 May 13, 2019

@sdroege sdroege merged commit 3dd95f3 into gtk-rs:master May 13, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.